tx · 5NtNUCbK3A5P3HF6PdotyQJm6a3cHT6x1fBLCaMDZivs 3NB9QGKiAF3B8wiJZbRd2PfWJAX3rasvCAX: -0.00700000 Waves 2022.07.16 22:22 [2142718] smart account 3NB9QGKiAF3B8wiJZbRd2PfWJAX3rasvCAX > SELF 0.00000000 Waves
{ "type": 13, "id": "5NtNUCbK3A5P3HF6PdotyQJm6a3cHT6x1fBLCaMDZivs", "fee": 700000, "feeAssetId": null, "timestamp": 1657999426318, "version": 2, "chainId": 84, "sender": "3NB9QGKiAF3B8wiJZbRd2PfWJAX3rasvCAX", "senderPublicKey": "25HKr2HEfEF45LGmh3fFPR4WDxgLz6p97kmgYdD4nGtX", "proofs": [ "4iTPo84DEZhaCbh8xC2bhswTCnAkVibdkZKT5pFcvVgzYk64DYVUHMf12dwNTgV9QVi6Kq6otKSsciu9AZcBRysT" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAALAAAAAAtiYXNlQXNzZXRJZAkAAlkAAAABAgAAACxINVVVdVBKN1dCWHpqZzZaMWFoQlV4ajdWV29WRkZmRzNCTXp5QUFuUld0NgAAAAAKbWluVG9IYXRjaAAAAAAAAA9CQAAAAAAJbWluVG9CdXJuAAAAAAAAAABkAAAAAA5wb3dlckFzc2V0TmFtZQIAAAAFQm9tYmEAAAAAC2Rlc2NyaXB0aW9uAgAAAAxCbGFtYmEgVG9rZW4AAAAABmtQb3dlcgIAAAAMcG93ZXJBc3NldElkAAAAAAhiYXNlRGVjaQAAAAAAAA9CQAAAAAAFcmF0aW8AAAAAAAAAAGQBAAAACWdldEFtb3VudAAAAAEAAAAIYW1vdW50SW4JAABrAAAAAwUAAAAIYW1vdW50SW4FAAAABXJhdGlvBQAAAAhiYXNlRGVjaQEAAAAMZ2V0T3V0QW1vdW50AAAAAQAAAAhhbW91bnRJbgkAAGkAAAACCQAAaAAAAAIJAABrAAAAAwUAAAAIYW1vdW50SW4AAAAAAAAAAFAAAAAAAAAAAGQFAAAACGJhc2VEZWN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AAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXllbmuL", "height": 2142718, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 29zsCWRgRdbFsiGkan944vy1JHEz2bp89zXwiGYG4k5G Next: none Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | func getAmount (amountIn) = fraction(amountIn, ratio, baseDeci) | |
21 | 21 | ||
22 | 22 | ||
23 | - | func getOutAmount (amountIn) = ((fraction(amountIn, 80, 100) / ratio) | |
23 | + | func getOutAmount (amountIn) = ((fraction(amountIn, 80, 100) * baseDeci) / ratio) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func checkPowerId () = match getString(kPower) { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let baseAssetId = fromBase58String("H5UUuPJ7WBXzjg6Z1ahBUxj7VWoVFFfG3BMzyAAnRWt6") | |
5 | 5 | ||
6 | 6 | let minToHatch = 1000000 | |
7 | 7 | ||
8 | 8 | let minToBurn = 100 | |
9 | 9 | ||
10 | 10 | let powerAssetName = "Bomba" | |
11 | 11 | ||
12 | 12 | let description = "Blamba Token" | |
13 | 13 | ||
14 | 14 | let kPower = "powerAssetId" | |
15 | 15 | ||
16 | 16 | let baseDeci = 1000000 | |
17 | 17 | ||
18 | 18 | let ratio = 100 | |
19 | 19 | ||
20 | 20 | func getAmount (amountIn) = fraction(amountIn, ratio, baseDeci) | |
21 | 21 | ||
22 | 22 | ||
23 | - | func getOutAmount (amountIn) = ((fraction(amountIn, 80, 100) / ratio) | |
23 | + | func getOutAmount (amountIn) = ((fraction(amountIn, 80, 100) * baseDeci) / ratio) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func checkPowerId () = match getString(kPower) { | |
27 | 27 | case p: String => | |
28 | 28 | p | |
29 | 29 | case _ => | |
30 | 30 | "Start" | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | @Callable(i) | |
35 | 35 | func hatchDucks () = if ((i.payments[0].assetId != baseAssetId)) | |
36 | 36 | then throw("Only BUGGS accepted!") | |
37 | 37 | else if ((minToHatch > i.payments[0].amount)) | |
38 | 38 | then throw("Min amount to invest is 100 BUGGS") | |
39 | 39 | else if ((checkPowerId() == "Start")) | |
40 | 40 | then { | |
41 | 41 | let powerAsset = Issue(powerAssetName, description, getAmount(i.payments[0].amount), 0, true) | |
42 | 42 | [powerAsset, StringEntry(kPower, toBase58String(calculateAssetId(powerAsset))), ScriptTransfer(i.caller, getAmount(i.payments[0].amount), calculateAssetId(powerAsset))] | |
43 | 43 | } | |
44 | 44 | else { | |
45 | 45 | let powerAssetId = fromBase58String(checkPowerId()) | |
46 | 46 | [Reissue(powerAssetId, getAmount(i.payments[0].amount), true), ScriptTransfer(i.caller, getAmount(i.payments[0].amount), powerAssetId)] | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func burnDucks () = { | |
53 | 53 | let powerAssetId = fromBase58String(checkPowerId()) | |
54 | 54 | if ((i.payments[0].assetId != powerAssetId)) | |
55 | 55 | then throw("Only Bomba accepted!") | |
56 | 56 | else if ((minToBurn > i.payments[0].amount)) | |
57 | 57 | then throw("Min amount to burn is 100 Bomba") | |
58 | 58 | else [Burn(powerAssetId, i.payments[0].amount), ScriptTransfer(i.caller, getOutAmount(i.payments[0].amount), baseAssetId)] | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | @Verifier(tx) | |
63 | 63 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
64 | 64 |
github/deemru/w8io/169f3d6 24.61 ms ◑