tx · 6tehFVyqziPwrK3x74XtDAD6xJVi1x36m9dfa5QnHyuK 3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx: -0.04000000 Waves 2022.04.25 20:36 [2024332] smart account 3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx > SELF 0.00000000 Waves
{ "type": 13, "id": "6tehFVyqziPwrK3x74XtDAD6xJVi1x36m9dfa5QnHyuK", "fee": 4000000, "feeAssetId": null, "timestamp": 1650908217313, "version": 2, "chainId": 84, "sender": "3Mvjrd9jd9BEQvHoiHnPKR2WqtZnvxopDcx", "senderPublicKey": "B37Jiw5CgfjxqxYgkAGeJpTmiCa4Cb6a9mh9fynZppFR", "proofs": [ "575zFsFUrhtpHUw9ky593HrW9PE3fJVjeg2wtFNyvnx81ePubCihcTfsGhNzE5j1MzwR6b2DdhUiyRDJqPi2fGX1" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEBEgUKAwgICBIAEgASAwoBCAAAAAkAAAAAGG1heFRva2VuQW1vdW50Rm9yUHJlc2FsZQAAAAAAAJiWgAAAAAAHdG9rZW5JZAEAAAAgYdTHJtpm4GwuO67Z7w+Qg9eAml6YMFJTv4sCKXVeLDUAAAAAFHByZXNhbGVQcmljZVBlclRva2VuAAAAAAAAAAAFAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3Zh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AAACAgAAAA1wcmVzYWxlU3RhdHVzBgUAAAADbmlsAAAAAWkBAAAACnNldFRva2VuSWQAAAABAAAABXRrbklkAwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwgFAAAABHRoaXMAAAAFYnl0ZXMJAAACAAAAAQIAAAAbT25seSBPd25lciBDYW4gc2V0IFRva2VuIElkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAB3Rva2VuSWQFAAAABXRrbklkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleYQdnKI=", "height": 2024332, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9ipaQakW9d6VCbjcTwcoxXBgfn71q6FjQHHPKUJETd8Z Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let maxTokenAmountForPresale = 10000000 | |
5 | 5 | ||
6 | - | let tokenId = base58' | |
6 | + | let tokenId = base58'7atjFuUvDnCqsg8uNC5PYEgg3UXAv94St5zuA6vSjMVE' | |
7 | 7 | ||
8 | 8 | let presalePricePerToken = 5 | |
9 | 9 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let maxTokenAmountForPresale = 10000000 | |
5 | 5 | ||
6 | - | let tokenId = base58' | |
6 | + | let tokenId = base58'7atjFuUvDnCqsg8uNC5PYEgg3UXAv94St5zuA6vSjMVE' | |
7 | 7 | ||
8 | 8 | let presalePricePerToken = 5 | |
9 | 9 | ||
10 | 10 | func tryGetInteger (key) = { | |
11 | 11 | let val = match getInteger(this, key) { | |
12 | 12 | case b: Int => | |
13 | 13 | b | |
14 | 14 | case _ => | |
15 | 15 | 0 | |
16 | 16 | } | |
17 | 17 | val | |
18 | 18 | } | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func tryGetString (key) = { | |
22 | 22 | let val = match getString(this, key) { | |
23 | 23 | case b: String => | |
24 | 24 | b | |
25 | 25 | case _ => | |
26 | 26 | "" | |
27 | 27 | } | |
28 | 28 | val | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
33 | 33 | case b: Boolean => | |
34 | 34 | b | |
35 | 35 | case _ => | |
36 | 36 | false | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getCurrentTokenAmountBoughtFromPresale (addr) = { | |
41 | 41 | let val = tryGetInteger((addr + "_tokenPresale")) | |
42 | 42 | val | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getRemainingPresaleTokenAmount () = { | |
47 | 47 | let val = match getInteger(this, "remainingPresaleTokenAmount") { | |
48 | 48 | case b: Int => | |
49 | 49 | b | |
50 | 50 | case _ => | |
51 | 51 | maxTokenAmountForPresale | |
52 | 52 | } | |
53 | 53 | val | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getPresaleStatus () = match getBoolean(this, "presaleStatus") { | |
58 | 58 | case b: Boolean => | |
59 | 59 | b | |
60 | 60 | case _ => | |
61 | 61 | true | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Callable(i) | |
66 | 66 | func buyTokensFromPresale (buyAmount) = { | |
67 | 67 | let callerAddress = toBase58String(i.caller.bytes) | |
68 | 68 | if (!(getPresaleStatus())) | |
69 | 69 | then throw("Presale Stopped by the Owner") | |
70 | 70 | else if ((buyAmount > getRemainingPresaleTokenAmount())) | |
71 | 71 | then throw("Exceeded Remaining Token Amount Dedicated for Presale") | |
72 | 72 | else [IntegerEntry((callerAddress + "_tokenPresale"), (buyAmount + getCurrentTokenAmountBoughtFromPresale(callerAddress))), IntegerEntry("remainingPresaleTokenAmount", (getRemainingPresaleTokenAmount() - buyAmount)), StringEntry((callerAddress + "_presaleAddresses"), callerAddress), ScriptTransfer(value(addressFromString(callerAddress)), buyAmount, tokenId)] | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(i) | |
78 | 78 | func buyNftsFromPresale (name,collectionId,metadata) = { | |
79 | 79 | let callerAddress = toBase58String(i.caller.bytes) | |
80 | 80 | if (!(getPresaleStatus())) | |
81 | 81 | then throw("Presale Stopped by the Owner") | |
82 | 82 | else { | |
83 | 83 | let nft = Issue(name, metadata, 1, 0, false) | |
84 | 84 | let nftId = calculateAssetId(nft) | |
85 | 85 | let nftIdStr = toBase58String(nftId) | |
86 | 86 | [StringEntry((nftIdStr + "_assetId"), nftIdStr), StringEntry((nftIdStr + "_ownerId"), callerAddress), StringEntry(((nftIdStr + "_collectionId_") + collectionId), nftIdStr), nft, ScriptTransfer(value(addressFromString(callerAddress)), 1, nftId)] | |
87 | 87 | } | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | ||
92 | 92 | @Callable(i) | |
93 | 93 | func stopPresale () = if ((i.caller.bytes != this.bytes)) | |
94 | 94 | then throw("Only Owner Can Stop the Presale") | |
95 | 95 | else [BooleanEntry("presaleStatus", false)] | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func reOpenPresale () = if ((i.caller.bytes != this.bytes)) | |
101 | 101 | then throw("Only Owner Can Re-Open the Presale") | |
102 | 102 | else [BooleanEntry("presaleStatus", true)] | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(i) | |
107 | 107 | func setTokenId (tknId) = if ((i.caller.bytes != this.bytes)) | |
108 | 108 | then throw("Only Owner Can set Token Id") | |
109 | 109 | else [StringEntry("tokenId", tknId)] | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | @Verifier(tx) | |
113 | 113 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
114 | 114 |
github/deemru/w8io/169f3d6 24.55 ms ◑