tx · 6o29o3F6Ua9zfeNsuzZwiNeCUndoMnKBQbR66kmkPKPs 3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB: -0.01400000 Waves 2021.06.03 05:15 [1553562] smart account 3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB > SELF 0.00000000 Waves
{ "type": 13, "id": "6o29o3F6Ua9zfeNsuzZwiNeCUndoMnKBQbR66kmkPKPs", "fee": 1400000, "feeAssetId": null, "timestamp": 1622686536147, "version": 2, "chainId": 84, "sender": "3Mr97MBt1TwRZHBK8R1EFDz8S8mxui5U4zB", "senderPublicKey": "CQ7vntBAYh2QZcKcqiiyEnQWWXsr98ysDptD23Wgxmvb", "proofs": [ "4BDTqUBgeamw53guyCPfAAGc4uuKTB3bCLMtknYL8xcMyjiPuNBxhazjMSo8sLeds9vgRsxoRczZZWYL1Z9hgLpW" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAAAQEAAAAQbGlzdFRvU3RyaW5nRnVuYwAAAAEAAAALSW50ZWdlckxpc3QKAQAAAAxsaXN0VG9TdHJpbmcAAAACAAAAA2FjYwAAAAFpCQAETQAAAAIFAAAAA2FjYwkAAaQAAAABCQABkQAAAAIFAAAAC0ludGVnZXJMaXN0BQAAAAFpBAAAAAskbGlzdDI0MjI4MAUAAAALSW50ZWdlckxpc3QEAAAACyRzaXplMjQyMjgwCQABkAAAAAEFAAAACyRsaXN0MjQyMjgwBAAAAAskYWNjMDI0MjI4MAUAAAADbmlsAwkAAAAAAAACBQAAAAskc2l6ZTI0MjI4MAAAAAAAAAAAAAUAAAALJGFjYzAyNDIyODAEAAAACyRhY2MxMjQyMjgwCQEAAAAMbGlzdFRvU3RyaW5nAAAAAgUAAAALJGFjYzAyNDIyODAJAAGRAAAAAgUAAAALJGxpc3QyNDIyODAAAAAAAAAAAAADCQAAAAAAAAIFAAAACyRzaXplMjQyMjgwAAAAAAAAAAABBQAAAAskYWNjMTI0MjI4MAQAAAALJGFjYzIyNDIyODAJAQA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FYXNzZXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5S50QeQ==", "height": 1553562, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HkZSCRHNeGyFoAzcHkK4AdK4LRroo3pGVmcYysjuNv9T Next: 6gPQ9QHqFZtsojcrwfccHMAMahdVZm9mJ4Jvzp5UETvz Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let kittenId = "GuobcHvW9WqotnkGUj7JkpcbXtgVfB37TA4JkgSj9Qbb" | |
4 | + | func listToStringFunc (IntegerList) = { | |
5 | + | func listToString (acc,i) = (acc :+ toString(IntegerList[i])) | |
5 | 6 | ||
6 | - | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
7 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
8 | - | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
9 | - | (toInt(randomHash, (offset * 8)) % variants) | |
7 | + | let $list242280 = IntegerList | |
8 | + | let $size242280 = size($list242280) | |
9 | + | let $acc0242280 = nil | |
10 | + | if (($size242280 == 0)) | |
11 | + | then $acc0242280 | |
12 | + | else { | |
13 | + | let $acc1242280 = listToString($acc0242280, $list242280[0]) | |
14 | + | if (($size242280 == 1)) | |
15 | + | then $acc1242280 | |
16 | + | else { | |
17 | + | let $acc2242280 = listToString($acc1242280, $list242280[1]) | |
18 | + | if (($size242280 == 2)) | |
19 | + | then $acc2242280 | |
20 | + | else { | |
21 | + | let $acc3242280 = listToString($acc2242280, $list242280[2]) | |
22 | + | if (($size242280 == 3)) | |
23 | + | then $acc3242280 | |
24 | + | else { | |
25 | + | let $acc4242280 = listToString($acc3242280, $list242280[3]) | |
26 | + | throw("List size exceed 3") | |
27 | + | } | |
28 | + | } | |
29 | + | } | |
30 | + | } | |
10 | 31 | } | |
11 | 32 | ||
12 | 33 | ||
13 | - | func generation (num) = if (if ((num > 0)) | |
14 | - | then true | |
15 | - | else (300 >= num)) | |
16 | - | then "G1" | |
17 | - | else if (if ((num > 300)) | |
18 | - | then true | |
19 | - | else (1000 >= num)) | |
20 | - | then "G2" | |
21 | - | else "G3" | |
22 | - | ||
23 | - | ||
24 | - | func geneCode (num) = if ((num == 100)) | |
25 | - | then "II-II-II-II" | |
26 | - | else if (if ((num >= 1)) | |
27 | - | then (3 >= num) | |
28 | - | else false) | |
29 | - | then "BB-BB-BB-BB" | |
30 | - | else if (if ((num > 3)) | |
31 | - | then (8 >= num) | |
32 | - | else false) | |
33 | - | then "CC-CC-CC-CC" | |
34 | - | else if (if ((num > 8)) | |
35 | - | then (15 >= num) | |
36 | - | else false) | |
37 | - | then "DD-DD-DD-DD" | |
38 | - | else if (if ((num > 15)) | |
39 | - | then (24 >= num) | |
40 | - | else false) | |
41 | - | then "EE-EE-EE-EE" | |
42 | - | else if (if ((num > 24)) | |
43 | - | then (35 >= num) | |
44 | - | else false) | |
45 | - | then "FF-FF-FF-FF" | |
46 | - | else if (if ((num > 35)) | |
47 | - | then (48 >= num) | |
48 | - | else false) | |
49 | - | then "GG-GG-GG-GG" | |
50 | - | else if (if ((num > 48)) | |
51 | - | then (51 >= num) | |
52 | - | else false) | |
53 | - | then "AA-AA-AA-AA" | |
54 | - | else "HH-HH-HH-HH" | |
55 | - | ||
56 | - | ||
57 | 34 | @Callable(i) | |
58 | - | func giveBirthKitten () = { | |
59 | - | let pmt = i.payments[0] | |
60 | - | let pmtId = toBase58String(value(pmt.assetId)) | |
61 | - | if ((pmtId != kittenId)) | |
62 | - | then throw("Please send Kitten token.") | |
63 | - | else { | |
64 | - | let kittenAmount = pmt.amount | |
65 | - | if ((kittenAmount > 300)) | |
66 | - | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
67 | - | else if ((300 > kittenAmount)) | |
68 | - | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
69 | - | else { | |
70 | - | let issueQuantity = match getInteger(this, "issueQuantity") { | |
71 | - | case a: Int => | |
72 | - | a | |
73 | - | case _ => | |
74 | - | 0 | |
75 | - | } | |
76 | - | let newQuantity = (issueQuantity + 1) | |
77 | - | let generationType = generation(newQuantity) | |
78 | - | let issueNft = Issue("Kitten(=^・^=)", ("generation:" + generationType), 1, 0, false) | |
79 | - | let issueNftId = calculateAssetId(issueNft) | |
80 | - | let blockHeight = lastBlock.height | |
81 | - | let typeRandom = getRandomNumber(100, issueNftId, blockHeight, 0) | |
82 | - | let genetype = geneCode(typeRandom) | |
83 | - | [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), genetype), IntegerEntry("issueQuantity", newQuantity)] | |
84 | - | } | |
85 | - | } | |
35 | + | func call () = { | |
36 | + | let count = 1 | |
37 | + | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
38 | + | let assetId = calculateAssetId(asset) | |
39 | + | let listToString = listToStringFunc([2, 3, 4]) | |
40 | + | if ((count == 1)) | |
41 | + | then throw(((((listToString[0] + ",") + listToString[1]) + ",") + listToString[2])) | |
42 | + | else [asset] | |
86 | 43 | } | |
87 | 44 | ||
88 | 45 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let kittenId = "GuobcHvW9WqotnkGUj7JkpcbXtgVfB37TA4JkgSj9Qbb" | |
4 | + | func listToStringFunc (IntegerList) = { | |
5 | + | func listToString (acc,i) = (acc :+ toString(IntegerList[i])) | |
5 | 6 | ||
6 | - | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
7 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
8 | - | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
9 | - | (toInt(randomHash, (offset * 8)) % variants) | |
7 | + | let $list242280 = IntegerList | |
8 | + | let $size242280 = size($list242280) | |
9 | + | let $acc0242280 = nil | |
10 | + | if (($size242280 == 0)) | |
11 | + | then $acc0242280 | |
12 | + | else { | |
13 | + | let $acc1242280 = listToString($acc0242280, $list242280[0]) | |
14 | + | if (($size242280 == 1)) | |
15 | + | then $acc1242280 | |
16 | + | else { | |
17 | + | let $acc2242280 = listToString($acc1242280, $list242280[1]) | |
18 | + | if (($size242280 == 2)) | |
19 | + | then $acc2242280 | |
20 | + | else { | |
21 | + | let $acc3242280 = listToString($acc2242280, $list242280[2]) | |
22 | + | if (($size242280 == 3)) | |
23 | + | then $acc3242280 | |
24 | + | else { | |
25 | + | let $acc4242280 = listToString($acc3242280, $list242280[3]) | |
26 | + | throw("List size exceed 3") | |
27 | + | } | |
28 | + | } | |
29 | + | } | |
30 | + | } | |
10 | 31 | } | |
11 | 32 | ||
12 | 33 | ||
13 | - | func generation (num) = if (if ((num > 0)) | |
14 | - | then true | |
15 | - | else (300 >= num)) | |
16 | - | then "G1" | |
17 | - | else if (if ((num > 300)) | |
18 | - | then true | |
19 | - | else (1000 >= num)) | |
20 | - | then "G2" | |
21 | - | else "G3" | |
22 | - | ||
23 | - | ||
24 | - | func geneCode (num) = if ((num == 100)) | |
25 | - | then "II-II-II-II" | |
26 | - | else if (if ((num >= 1)) | |
27 | - | then (3 >= num) | |
28 | - | else false) | |
29 | - | then "BB-BB-BB-BB" | |
30 | - | else if (if ((num > 3)) | |
31 | - | then (8 >= num) | |
32 | - | else false) | |
33 | - | then "CC-CC-CC-CC" | |
34 | - | else if (if ((num > 8)) | |
35 | - | then (15 >= num) | |
36 | - | else false) | |
37 | - | then "DD-DD-DD-DD" | |
38 | - | else if (if ((num > 15)) | |
39 | - | then (24 >= num) | |
40 | - | else false) | |
41 | - | then "EE-EE-EE-EE" | |
42 | - | else if (if ((num > 24)) | |
43 | - | then (35 >= num) | |
44 | - | else false) | |
45 | - | then "FF-FF-FF-FF" | |
46 | - | else if (if ((num > 35)) | |
47 | - | then (48 >= num) | |
48 | - | else false) | |
49 | - | then "GG-GG-GG-GG" | |
50 | - | else if (if ((num > 48)) | |
51 | - | then (51 >= num) | |
52 | - | else false) | |
53 | - | then "AA-AA-AA-AA" | |
54 | - | else "HH-HH-HH-HH" | |
55 | - | ||
56 | - | ||
57 | 34 | @Callable(i) | |
58 | - | func giveBirthKitten () = { | |
59 | - | let pmt = i.payments[0] | |
60 | - | let pmtId = toBase58String(value(pmt.assetId)) | |
61 | - | if ((pmtId != kittenId)) | |
62 | - | then throw("Please send Kitten token.") | |
63 | - | else { | |
64 | - | let kittenAmount = pmt.amount | |
65 | - | if ((kittenAmount > 300)) | |
66 | - | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
67 | - | else if ((300 > kittenAmount)) | |
68 | - | then throw("Amount of Kitten tokens sent is 3 tokens.") | |
69 | - | else { | |
70 | - | let issueQuantity = match getInteger(this, "issueQuantity") { | |
71 | - | case a: Int => | |
72 | - | a | |
73 | - | case _ => | |
74 | - | 0 | |
75 | - | } | |
76 | - | let newQuantity = (issueQuantity + 1) | |
77 | - | let generationType = generation(newQuantity) | |
78 | - | let issueNft = Issue("Kitten(=^・^=)", ("generation:" + generationType), 1, 0, false) | |
79 | - | let issueNftId = calculateAssetId(issueNft) | |
80 | - | let blockHeight = lastBlock.height | |
81 | - | let typeRandom = getRandomNumber(100, issueNftId, blockHeight, 0) | |
82 | - | let genetype = geneCode(typeRandom) | |
83 | - | [issueNft, ScriptTransfer(i.caller, 1, issueNftId), StringEntry(toBase58String(value(issueNftId)), genetype), IntegerEntry("issueQuantity", newQuantity)] | |
84 | - | } | |
85 | - | } | |
35 | + | func call () = { | |
36 | + | let count = 1 | |
37 | + | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
38 | + | let assetId = calculateAssetId(asset) | |
39 | + | let listToString = listToStringFunc([2, 3, 4]) | |
40 | + | if ((count == 1)) | |
41 | + | then throw(((((listToString[0] + ",") + listToString[1]) + ",") + listToString[2])) | |
42 | + | else [asset] | |
86 | 43 | } | |
87 | 44 | ||
88 | 45 | ||
89 | 46 | @Verifier(tx) | |
90 | 47 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
91 | 48 |
github/deemru/w8io/026f985 29.29 ms ◑