tx · FKNkkU5R8MAFHYK5T3tmrYW3SSHbMoLgQD38VD4gYfbH 3N9R81xcbc2XacCpsUn4tHv2T6n77bqGm2L: -0.01400000 Waves 2022.05.11 09:53 [2046669] smart account 3N9R81xcbc2XacCpsUn4tHv2T6n77bqGm2L > SELF 0.00000000 Waves
{ "type": 13, "id": "FKNkkU5R8MAFHYK5T3tmrYW3SSHbMoLgQD38VD4gYfbH", "fee": 1400000, "feeAssetId": null, "timestamp": 1652251992428, "version": 2, "chainId": 84, "sender": "3N9R81xcbc2XacCpsUn4tHv2T6n77bqGm2L", "senderPublicKey": "2YmkAfmy9snQ5m9gFmoTJQs2raxGNbBFkRJ3HC4Li7mL", "proofs": [ "3QdDkRZqmrHhUTobLZWn3jp5NzRcUh9fBgJFkUCcmHzyQnnDhsExdzRRrwqowCVjpfQzVTDw71pUUUMdbx8vqzW8" ], "script": "base64:AAIFAAAAAAAAABkIAhIDCgEBEgUKAwgICBIAEgASABIDCgEBAAAAEgAAAAAYbWF4VG9rZW5BbW91bnRGb3JQcmVzYWxlAAAAAAAAmJaAAAAAAAd0b2tlbklkAQAAACCwCDyzdDiRD2XG2KnElAEtpkHNZNOBzaPiwYArgHr3GgAAAAAJY2xhaW1BZGRyAQAAABoBVJbC74rYcvif26LO41st+yuak7E6uU2KbgAAAAADd3ZzAAAAAAAF9eEAAAAAAA50b2tlblVuaXRQcmljZQAAAAAAAAAABQAAAAALZGVub21pbmF0b3IAAAAAAACYloAAAAAAD2RlY2ltYWxzSW5Ub2tlbgAAAAAAAAAAZAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3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 0 } View: original | compacted Prev: 2uvfcc1ehxggKEeDkQpyNFEeV5EDfk2Ps1HHPbviKAQL Next: CffXqaZiMoeZ5RxbW4ojqiWzhHwzNg2qn36ZNkYykxxZ Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let maxTokenAmountForPresale = 10000000 | |
5 | 5 | ||
6 | - | let tokenId = base58' | |
6 | + | let tokenId = base58'CrA3Jiqb3ev7zQ7rHWHvKCHx8iVZnK9tkfJdqsaLMkWD' | |
7 | 7 | ||
8 | 8 | let claimAddr = base58'3N3fEf4mmVyYcbeuHYmZvXuJjoXjH5WRuEV' | |
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'CrA3Jiqb3ev7zQ7rHWHvKCHx8iVZnK9tkfJdqsaLMkWD' | |
7 | 7 | ||
8 | 8 | let claimAddr = base58'3N3fEf4mmVyYcbeuHYmZvXuJjoXjH5WRuEV' | |
9 | 9 | ||
10 | 10 | let wvs = 100000000 | |
11 | 11 | ||
12 | 12 | let tokenUnitPrice = 5 | |
13 | 13 | ||
14 | 14 | let denominator = 10000000 | |
15 | 15 | ||
16 | 16 | let decimalsInToken = 100 | |
17 | 17 | ||
18 | 18 | func tryGetInteger (key) = { | |
19 | 19 | let val = match getInteger(this, key) { | |
20 | 20 | case b: Int => | |
21 | 21 | b | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | val | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func tryGetString (key) = { | |
30 | 30 | let val = match getString(this, key) { | |
31 | 31 | case b: String => | |
32 | 32 | b | |
33 | 33 | case _ => | |
34 | 34 | "" | |
35 | 35 | } | |
36 | 36 | val | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
41 | 41 | case b: Boolean => | |
42 | 42 | b | |
43 | 43 | case _ => | |
44 | 44 | false | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getCurrentTokenAmountBoughtFromPresale (addr) = { | |
49 | 49 | let val = tryGetInteger((addr + "_tokenPresale")) | |
50 | 50 | val | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getRemainingPresaleTokenAmount () = { | |
55 | 55 | let val = match getInteger(this, "remainingPresaleTokenAmount") { | |
56 | 56 | case b: Int => | |
57 | 57 | b | |
58 | 58 | case _ => | |
59 | 59 | maxTokenAmountForPresale | |
60 | 60 | } | |
61 | 61 | val | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getPresaleStatus () = match getBoolean(this, "presaleStatus") { | |
66 | 66 | case b: Boolean => | |
67 | 67 | b | |
68 | 68 | case _ => | |
69 | 69 | true | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getTotalNftCount () = { | |
74 | 74 | let val = match getInteger(this, "totalNftCount") { | |
75 | 75 | case b: Int => | |
76 | 76 | b | |
77 | 77 | case _ => | |
78 | 78 | 0 | |
79 | 79 | } | |
80 | 80 | val | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getRemainingNftCount () = { | |
85 | 85 | let val = match getInteger(this, "remainingNftCount") { | |
86 | 86 | case b: Int => | |
87 | 87 | b | |
88 | 88 | case _ => | |
89 | 89 | 0 | |
90 | 90 | } | |
91 | 91 | val | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getRemainingNfts () = { | |
96 | 96 | let val = match getString(this, "remainingNfts") { | |
97 | 97 | case b: String => | |
98 | 98 | b | |
99 | 99 | case _ => | |
100 | 100 | "" | |
101 | 101 | } | |
102 | 102 | val | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func getNftSoldOutOrNot (nftId) = match getBoolean(this, (nftId + "_soldOut")) { | |
107 | 107 | case b: Boolean => | |
108 | 108 | b | |
109 | 109 | case _ => | |
110 | 110 | false | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func getRandomNumber (i) = { | |
115 | 115 | let rand = ((((i.transactionId + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
116 | 116 | sha256(rand) | |
117 | 117 | } | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func buyTokensFromPresale (buyAmount) = { | |
122 | 122 | let callerAddress = toBase58String(i.caller.bytes) | |
123 | 123 | let pmt = value(i.payments[0]) | |
124 | 124 | let amount = pmt.amount | |
125 | 125 | if (!(getPresaleStatus())) | |
126 | 126 | then throw("Presale Stopped by the Owner") | |
127 | 127 | else if ((buyAmount > getRemainingPresaleTokenAmount())) | |
128 | 128 | then throw("Exceeded Remaining Token Amount Dedicated for Presale") | |
129 | 129 | else if (((fraction(buyAmount, tokenUnitPrice, denominator) * wvs) > amount)) | |
130 | 130 | then throw("Not enough payments in waves") | |
131 | 131 | else [IntegerEntry((callerAddress + "_tokenPresale"), (buyAmount + getCurrentTokenAmountBoughtFromPresale(callerAddress))), IntegerEntry("remainingPresaleTokenAmount", (getRemainingPresaleTokenAmount() - buyAmount)), StringEntry((callerAddress + "_presaleAddresses"), callerAddress), ScriptTransfer(value(addressFromString(callerAddress)), (buyAmount * decimalsInToken), tokenId)] | |
132 | 132 | } | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | ||
136 | 136 | @Callable(i) | |
137 | 137 | func mintNftByOwner (name,collectionId,metadata) = { | |
138 | 138 | let callerAddress = toBase58String(i.caller.bytes) | |
139 | 139 | if ((i.caller != this)) | |
140 | 140 | then throw("Only Dapp Owner Can Mint") | |
141 | 141 | else { | |
142 | 142 | let nft = Issue(name, metadata, 1, 0, false) | |
143 | 143 | let nftId = calculateAssetId(nft) | |
144 | 144 | let nftIdStr = toBase58String(nftId) | |
145 | 145 | [nft, StringEntry((nftIdStr + "_assetId"), nftIdStr), StringEntry((nftIdStr + "_ownerAddr"), callerAddress), StringEntry(((nftIdStr + "_collectionId_") + collectionId), nftIdStr), IntegerEntry("totalNftCount", (getTotalNftCount() + 1)), IntegerEntry("remainingNftCount", (getRemainingNftCount() + 1)), StringEntry(toString((getTotalNftCount() + 1)), nftIdStr), StringEntry("remainingNfts", ((getRemainingNfts() + toString((getTotalNftCount() + 1))) + "_")), BooleanEntry((nftIdStr + "_soldOut"), false)] | |
146 | 146 | } | |
147 | 147 | } | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | ||
151 | 151 | @Callable(i) | |
152 | 152 | func buyNftsFromPresale () = { | |
153 | 153 | let callerAddress = toBase58String(i.caller.bytes) | |
154 | 154 | if (!(getPresaleStatus())) | |
155 | 155 | then throw("Presale Stopped by the Owner") | |
156 | 156 | else if ((getRemainingNftCount() == 0)) | |
157 | 157 | then throw("Nfts are not available for buying - all are sold") | |
158 | 158 | else { | |
159 | 159 | let remainingNftList = split(getRemainingNfts(), "_") | |
160 | 160 | let remainingNftListSize = getRemainingNftCount() | |
161 | 161 | let rand = toInt(getRandomNumber(i)) | |
162 | 162 | let position = (rand % remainingNftListSize) | |
163 | 163 | let selectedNftNumber = remainingNftList[position] | |
164 | 164 | let selectedNftStr = getStringValue(this, selectedNftNumber) | |
165 | 165 | let updatedRemainingNftList = removeByIndex(remainingNftList, position) | |
166 | 166 | let updatedRemainingNftListAsString = makeString(updatedRemainingNftList, "_") | |
167 | 167 | [ScriptTransfer(value(addressFromString(callerAddress)), 1, fromBase58String(selectedNftStr)), StringEntry((selectedNftStr + "_ownerAddr"), callerAddress), IntegerEntry("remainingNftCount", (getRemainingNftCount() - 1)), StringEntry("remainingNfts", updatedRemainingNftListAsString), BooleanEntry((selectedNftStr + "_soldOut"), true)] | |
168 | 168 | } | |
169 | 169 | } | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | 174 | func stopPresale () = if ((i.caller.bytes != this.bytes)) | |
175 | 175 | then throw("Only Owner Can Stop the Presale") | |
176 | 176 | else [BooleanEntry("presaleStatus", false)] | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | ||
180 | 180 | @Callable(i) | |
181 | 181 | func reOpenPresale () = if ((i.caller.bytes != this.bytes)) | |
182 | 182 | then throw("Only Owner Can Re-Open the Presale") | |
183 | 183 | else [BooleanEntry("presaleStatus", true)] | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(i) | |
188 | 188 | func claim (amount) = if ((i.caller.bytes != this.bytes)) | |
189 | 189 | then throw("Only Owner Can Claim") | |
190 | 190 | else [ScriptTransfer(Address(claimAddr), (amount * wvs), unit)] | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | @Verifier(tx) | |
194 | 194 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
195 | 195 |
github/deemru/w8io/026f985 28.91 ms ◑