tx · VAAjUJzmudDhdHHhxxTYksgqHMB6a3nUvk3MPqLBZxo

3MrrWZRXFipBPwYy79PVBEVrR7oYW62jf8m:  -0.04000000 Waves

2022.05.11 20:09 [2047286] smart account 3MrrWZRXFipBPwYy79PVBEVrR7oYW62jf8m > SELF 0.00000000 Waves

{ "type": 13, "id": "VAAjUJzmudDhdHHhxxTYksgqHMB6a3nUvk3MPqLBZxo", "fee": 4000000, "feeAssetId": null, "timestamp": 1652288977000, "version": 2, "chainId": 84, "sender": "3MrrWZRXFipBPwYy79PVBEVrR7oYW62jf8m", "senderPublicKey": "AaHNopvbKHuDBasQJKhbMwM4d2XpUNjcJRJtfjEDbXQx", "proofs": [ "2TnoN7jKJt7ii9d9TAGP9rXTkQLJsBUkCUo5mqCMWyXNMuEtruYzTyMFMMR5JYQ2two881wVDLuPdn2qBDgezVNz" ], "script": "base64:AAIFAAAAAAAAABkIAhIDCgEBEgUKAwgICBIAEgASABIDCgEBAAAAEgAAAAAYbWF4VG9rZW5BbW91bnRGb3JQcmVzYWxlAAAAAAAAmJaAAAAAAAd0b2tlbklkAQAAACC25cEgIXwI679AIVs9PIKhoyN9ZeI8m1tIzfgUgaNPWwAAAAAJY2xhaW1BZGRyAQAAABoBVJbC74rYcvif26LO41st+yuak7E6uU2KbgAAAAADd3ZzAAAAAAAF9eEAAAAAAA50b2tlblVuaXRQcmljZQAAAAAAAAAABQAAAAALZGVub21pbmF0b3IAAAAAAACYloAAAAAAD2RlY2ltYWxzSW5Ub2tlbgAAAAAABfXhAAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQA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Jvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5gXQBgQ==", "height": 2047286, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8U52z4b6U2VPdBERpdMWGQt9rmTkBve2RZrEDJK2SLBf Next: none Diff:
OldNewDifferences
1313
1414 let denominator = 10000000
1515
16-let decimalsInToken = 100
16+let decimalsInToken = 100000000
1717
1818 func tryGetInteger (key) = {
1919 let val = match getInteger(this, key) {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxTokenAmountForPresale = 10000000
55
66 let tokenId = base58'DJxQ2KqhzD9KyfvCAgbTnGAgDEqCHkkYYz9bZcRmatGa'
77
88 let claimAddr = base58'3N3fEf4mmVyYcbeuHYmZvXuJjoXjH5WRuEV'
99
1010 let wvs = 100000000
1111
1212 let tokenUnitPrice = 5
1313
1414 let denominator = 10000000
1515
16-let decimalsInToken = 100
16+let decimalsInToken = 100000000
1717
1818 func tryGetInteger (key) = {
1919 let val = match getInteger(this, key) {
2020 case b: Int =>
2121 b
2222 case _ =>
2323 0
2424 }
2525 val
2626 }
2727
2828
2929 func tryGetString (key) = {
3030 let val = match getString(this, key) {
3131 case b: String =>
3232 b
3333 case _ =>
3434 ""
3535 }
3636 val
3737 }
3838
3939
4040 func tryGetBoolean (key) = match getBoolean(this, key) {
4141 case b: Boolean =>
4242 b
4343 case _ =>
4444 false
4545 }
4646
4747
4848 func getCurrentTokenAmountBoughtFromPresale (addr) = {
4949 let val = tryGetInteger((addr + "_tokenPresale"))
5050 val
5151 }
5252
5353
5454 func getRemainingPresaleTokenAmount () = {
5555 let val = match getInteger(this, "remainingPresaleTokenAmount") {
5656 case b: Int =>
5757 b
5858 case _ =>
5959 maxTokenAmountForPresale
6060 }
6161 val
6262 }
6363
6464
6565 func getPresaleStatus () = match getBoolean(this, "presaleStatus") {
6666 case b: Boolean =>
6767 b
6868 case _ =>
6969 true
7070 }
7171
7272
7373 func getTotalNftCount () = {
7474 let val = match getInteger(this, "totalNftCount") {
7575 case b: Int =>
7676 b
7777 case _ =>
7878 0
7979 }
8080 val
8181 }
8282
8383
8484 func getRemainingNftCount () = {
8585 let val = match getInteger(this, "remainingNftCount") {
8686 case b: Int =>
8787 b
8888 case _ =>
8989 0
9090 }
9191 val
9292 }
9393
9494
9595 func getRemainingNfts () = {
9696 let val = match getString(this, "remainingNfts") {
9797 case b: String =>
9898 b
9999 case _ =>
100100 ""
101101 }
102102 val
103103 }
104104
105105
106106 func getNftSoldOutOrNot (nftId) = match getBoolean(this, (nftId + "_soldOut")) {
107107 case b: Boolean =>
108108 b
109109 case _ =>
110110 false
111111 }
112112
113113
114114 func getRandomNumber (i) = {
115115 let rand = ((((i.transactionId + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
116116 sha256(rand)
117117 }
118118
119119
120120 @Callable(i)
121121 func buyTokensFromPresale (buyAmount) = {
122122 let callerAddress = toBase58String(i.caller.bytes)
123123 let pmt = value(i.payments[0])
124124 let amount = pmt.amount
125125 if (!(getPresaleStatus()))
126126 then throw("Presale Stopped by the Owner")
127127 else if ((buyAmount > getRemainingPresaleTokenAmount()))
128128 then throw("Exceeded Remaining Token Amount Dedicated for Presale")
129129 else if (((fraction(buyAmount, tokenUnitPrice, denominator) * wvs) > amount))
130130 then throw("Not enough payments in waves")
131131 else [IntegerEntry((callerAddress + "_tokenPresale"), (buyAmount + getCurrentTokenAmountBoughtFromPresale(callerAddress))), IntegerEntry("remainingPresaleTokenAmount", (getRemainingPresaleTokenAmount() - buyAmount)), StringEntry((callerAddress + "_presaleAddresses"), callerAddress), ScriptTransfer(value(addressFromString(callerAddress)), (buyAmount * decimalsInToken), tokenId)]
132132 }
133133
134134
135135
136136 @Callable(i)
137137 func mintNftByOwner (name,collectionId,metadata) = {
138138 let callerAddress = toBase58String(i.caller.bytes)
139139 if ((i.caller != this))
140140 then throw("Only Dapp Owner Can Mint")
141141 else {
142142 let nft = Issue(name, metadata, 1, 0, false)
143143 let nftId = calculateAssetId(nft)
144144 let nftIdStr = toBase58String(nftId)
145145 [nft, StringEntry((nftIdStr + "_metadata"), metadata), 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)]
146146 }
147147 }
148148
149149
150150
151151 @Callable(i)
152152 func buyNftsFromPresale () = {
153153 let callerAddress = toBase58String(i.caller.bytes)
154154 if (!(getPresaleStatus()))
155155 then throw("Presale Stopped by the Owner")
156156 else if ((getRemainingNftCount() == 0))
157157 then throw("Nfts are not available for buying - all are sold")
158158 else {
159159 let remainingNftList = split(getRemainingNfts(), "_")
160160 let remainingNftListSize = getRemainingNftCount()
161161 let rand = toInt(getRandomNumber(i))
162162 let position = (rand % remainingNftListSize)
163163 let selectedNftNumber = remainingNftList[position]
164164 let selectedNftStr = getStringValue(this, selectedNftNumber)
165165 let updatedRemainingNftList = removeByIndex(remainingNftList, position)
166166 let updatedRemainingNftListAsString = makeString(updatedRemainingNftList, "_")
167167 [ScriptTransfer(value(addressFromString(callerAddress)), 1, fromBase58String(selectedNftStr)), StringEntry((selectedNftStr + "_ownerAddr"), callerAddress), IntegerEntry("remainingNftCount", (getRemainingNftCount() - 1)), StringEntry("remainingNfts", updatedRemainingNftListAsString), BooleanEntry((selectedNftStr + "_soldOut"), true)]
168168 }
169169 }
170170
171171
172172
173173 @Callable(i)
174174 func stopPresale () = if ((i.caller.bytes != this.bytes))
175175 then throw("Only Owner Can Stop the Presale")
176176 else [BooleanEntry("presaleStatus", false)]
177177
178178
179179
180180 @Callable(i)
181181 func reOpenPresale () = if ((i.caller.bytes != this.bytes))
182182 then throw("Only Owner Can Re-Open the Presale")
183183 else [BooleanEntry("presaleStatus", true)]
184184
185185
186186
187187 @Callable(i)
188188 func claim (amount) = if ((i.caller.bytes != this.bytes))
189189 then throw("Only Owner Can Claim")
190190 else [ScriptTransfer(Address(claimAddr), (amount * wvs), unit)]
191191
192192
193193 @Verifier(tx)
194194 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
195195

github/deemru/w8io/169f3d6 
48.90 ms