tx · 2teSkpPX4zUSQr5Mg7BHRVh3qXvZcXUBi6bQquESHCWi 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9: -0.01400000 Waves 2022.01.10 16:56 [1872908] smart account 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9 > SELF 0.00000000 Waves
{ "type": 13, "id": "2teSkpPX4zUSQr5Mg7BHRVh3qXvZcXUBi6bQquESHCWi", "fee": 1400000, "feeAssetId": null, "timestamp": 1641822976187, "version": 2, "chainId": 84, "sender": "3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9", "senderPublicKey": "HwnFy5MZJ9eyVKF9GSXN8nuA5uT2rcvnVqHw9vCv3DNn", "proofs": [ "3ybnWUVSYsxJbVB4dYEwveUfk4C5CWU32VDHQcn5mbGXFy4A3GpVbxep1tR2rxtkXJV7tLmhWsuCuhNtq3T5ppzj" ], "script": "base64:AAIFAAAAAAAAAZ4IAhIDCgEIEgMKAQQSABoPCgFhEgpzaGlueXdnZ2lkGhEKAWISDGFkbWluQWRkcmVzcxoXCgFjEhJwcmVzYWxldG9rZW5hbW91bnQaGAoBZBITbWF4VG9rZW5zcGVyQWRkcmVzcxoJCgFlEgR1c2ROGhIKAWYSDXRyeUdldEludGVnZXIaCAoBZxIDa2V5GgwKAWgSByRtYXRjaDAaBgoBaRIBYhoSCgFqEg10cnlHZXRCb29sZWFuGhIKAWsSDWlzR2FtZVN0YXJ0ZWQaEgoBbBINaXNXaGl0ZUxpc3RlZBoPCgFtEgphZGRyZXNzU3RyGgYKAW4SAWkaCgoBbxIFc3RhcnQaBwoBcBICd2waCAoBcRIDcG10Gg0KAXISCGFtb3VudEluGgwKAXMSB2Fzc2V0SW4aEwoBdBIOcmVzZXJ2ZWRBbW91bnQaFAoBdRIPYWxyZWFkeVJlc2VydmVkGhQKAXYSD3JlbWFpbmluZ1Rva2VucxoPCgF3EgpyZXNlcnZhYmxlGhUKAXgSEHJlbWFpbmluZ1Rva2VuczIAAAAJAA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gIAAAAUWW91IGNhbiByZXNlcnZlIG1heCAJAAGkAAAAAQUAAAABdwIAAAAGIFNIRUdHBAAAAAF4CQAAZQAAAAIFAAAAAXYFAAAAAXQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAABbQIAAAAJX1Jlc2VydmVkCQAAZAAAAAIFAAAAAXQFAAAAAXUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAEFJlbWFpbmluZ19Ub2tlbnMFAAAAAXgJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAABYgUAAAABcgUAAAABZQUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAEVhsZQ==", "height": 1872908, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A25tGwvS1yK7BuGxVTMHat1ZkZaQ9XDN4PwcGGVqvzz8 Next: CMpHpL2Q3XU5N77R63XpHfW7ojg1XtU4thZCZZqrVQeY Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | + | ||
6 | + | let adminAddress = addressFromStringValue("3N2fmsxjTetfnJBXEUpnALKcAQeNR4EizQQ") | |
7 | + | ||
8 | + | let presaletokenamount = 500000000 | |
9 | + | ||
10 | + | let maxTokensperAddress = 10000 | |
11 | + | ||
12 | + | let usdN = unit | |
13 | + | ||
14 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
15 | + | case b: Int => | |
16 | + | b | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func tryGetBoolean (key) = match getBoolean(this, key) { | |
23 | + | case b: Boolean => | |
24 | + | b | |
25 | + | case _ => | |
26 | + | false | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | func isGameStarted () = tryGetBoolean("Game_Started") | |
31 | + | ||
32 | + | ||
33 | + | func isWhiteListed (addressStr) = tryGetBoolean((addressStr + "_whiteListed")) | |
4 | 34 | ||
5 | 35 | ||
6 | 36 | @Callable(i) | |
7 | - | func call () = { | |
8 | - | let asset = Issue("TESTSHEGG", "Ducklization test shiny Egg", 10000000, 8, true) | |
9 | - | let assetId = calculateAssetId(asset) | |
10 | - | [StringEntry("SHINYEGG_ASSET_ID", toBase58String(assetId)), BinaryEntry("SHINYEGG_ASSET_ID", assetId)] | |
37 | + | func addToWhiteList (addressStr) = if ((i.caller != this)) | |
38 | + | then throw("you are not authorized to perform this operation") | |
39 | + | else [BooleanEntry((addressStr + "_whiteListed"), true)] | |
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | @Callable(i) | |
44 | + | func setStartGame (start) = if ((i.caller != this)) | |
45 | + | then throw("you are not authorized to perform this operation") | |
46 | + | else [BooleanEntry("Game_Started", start)] | |
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | @Callable(i) | |
51 | + | func reserveTokens () = { | |
52 | + | let addressStr = toString(i.caller) | |
53 | + | let wl = isWhiteListed(addressStr) | |
54 | + | if (!(wl)) | |
55 | + | then throw("you are not whitelisted!") | |
56 | + | else { | |
57 | + | let pmt = i.payments[0] | |
58 | + | if ((pmt == pmt)) | |
59 | + | then { | |
60 | + | let amountIn = value(i.payments[0].amount) | |
61 | + | if ((amountIn == amountIn)) | |
62 | + | then { | |
63 | + | let assetIn = pmt.assetId | |
64 | + | if ((assetIn == assetIn)) | |
65 | + | then { | |
66 | + | let reservedAmount = amountIn | |
67 | + | if ((reservedAmount == reservedAmount)) | |
68 | + | then { | |
69 | + | let alreadyReserved = tryGetInteger((addressStr + "_Reserved")) | |
70 | + | if ((alreadyReserved == alreadyReserved)) | |
71 | + | then { | |
72 | + | let remainingTokens = tryGetInteger("Remaining_Tokens") | |
73 | + | if ((assetIn != usdN)) | |
74 | + | then throw("ONLY USDN ALLOWED") | |
75 | + | else if ((0 >= remainingTokens)) | |
76 | + | then throw("Presale is out of stock!") | |
77 | + | else if ((reservedAmount > remainingTokens)) | |
78 | + | then throw((("You can reserve only" + toString(remainingTokens)) + " SHEGG")) | |
79 | + | else { | |
80 | + | let reservable = (maxTokensperAddress - alreadyReserved) | |
81 | + | if ((alreadyReserved > reservable)) | |
82 | + | then throw((("You can reserve max " + toString(reservable)) + " SHEGG")) | |
83 | + | else { | |
84 | + | let remainingTokens2 = (remainingTokens - reservedAmount) | |
85 | + | [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + alreadyReserved)), IntegerEntry("Remaining_Tokens", remainingTokens2), ScriptTransfer(adminAddress, amountIn, usdN)] | |
86 | + | } | |
87 | + | } | |
88 | + | } | |
89 | + | else throw("Strict value is not equal to itself.") | |
90 | + | } | |
91 | + | else throw("Strict value is not equal to itself.") | |
92 | + | } | |
93 | + | else throw("Strict value is not equal to itself.") | |
94 | + | } | |
95 | + | else throw("Strict value is not equal to itself.") | |
96 | + | } | |
97 | + | else throw("Strict value is not equal to itself.") | |
98 | + | } | |
11 | 99 | } | |
12 | 100 | ||
13 | - | ||
14 | - | @Verifier(tx) | |
15 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
16 | 101 |
github/deemru/w8io/169f3d6 26.23 ms ◑