tx · CDYXmg9TCXzPHJD2PVHbkA9miDTQm8eezhHv9yEbzBXN

3NAtXa4xfYy3teTxeJXWY4ZTD9KGpkyACHC:  -0.11000000 Waves

2022.04.26 21:52 [2025837] smart account 3NAtXa4xfYy3teTxeJXWY4ZTD9KGpkyACHC > SELF 0.00000000 Waves

{ "type": 13, "id": "CDYXmg9TCXzPHJD2PVHbkA9miDTQm8eezhHv9yEbzBXN", "fee": 11000000, "feeAssetId": null, "timestamp": 1650999171597, "version": 2, "chainId": 84, "sender": "3NAtXa4xfYy3teTxeJXWY4ZTD9KGpkyACHC", "senderPublicKey": "CKnmMfPcdFm7C2Sy6TJPDKmAfFg31Dev2KLMojF9gWwp", "proofs": [ "3HxjSGun3XSQKCfNPwzxr7tRE8EWhRYbm1uEy43gedXwS1rYX48ZqdvrXFjRvQzPAcNMUu5NPT1vreKwbtUtK52Q" ], "script": "base64:AAIFAAAAAAAAABkIAhIDCgEBEgUKAwgICBIAEgASABIDCgEBAAAAEgAAAAAYbWF4VG9rZW5BbW91bnRGb3JQcmVzYWxlAAAAAAAAmJaAAAAAAAd0b2tlbklkAQAAACA1ijvaNyhGD+h/txUPAELWlOI9ZDTDfzaN+IgihjG0cwAAAAAJY2xhaW1BZGRyAQAAABoBVJbC74rYcvif26LO41st+yuak7E6uU2KbgAAAAADd3ZzAAAAAAAF9eEAAAAAAA50b2tlblVuaXRQcmljZQAAAAAAAAAABQAAAAALZGVub21pbmF0b3IAAAAAAACYloAAAAAAD2RlY2ltYWxzSW5Ub2tlbgAAAAAAAAAAZAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAA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W50cnkAAAACAgAAAA1wcmVzYWxlU3RhdHVzBwUAAAADbmlsAAAAAWkBAAAADXJlT3BlblByZXNhbGUAAAAAAwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwgFAAAABHRoaXMAAAAFYnl0ZXMJAAACAAAAAQIAAAAiT25seSBPd25lciBDYW4gUmUtT3BlbiB0aGUgUHJlc2FsZQkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgIAAAANcHJlc2FsZVN0YXR1cwYFAAAAA25pbAAAAAFpAQAAAAVjbGFpbQAAAAEAAAAGYW1vdW50AwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwgFAAAABHRoaXMAAAAFYnl0ZXMJAAACAAAAAQIAAAAUT25seSBPd25lciBDYW4gQ2xhaW0JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABBQAAAAljbGFpbUFkZHIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnZ3qmI", "height": 2025837, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5TEsztvnFZqWVjjuXML6hJ5AeYet2SoXDJFz7EyXaifJ Next: C8Nin9boEhQp29QKsS2rmdFna2ggR9w4D6z42mXjM1gi Diff:
OldNewDifferences
44 let maxTokenAmountForPresale = 10000000
55
66 let tokenId = base58'4bzs2y3QjBq4GEMrNcydRLMX1ReRrJ223fxNXyqyNUXL'
7+
8+let claimAddr = base58'3N3fEf4mmVyYcbeuHYmZvXuJjoXjH5WRuEV'
79
810 let wvs = 100000000
911
180182 else [BooleanEntry("presaleStatus", true)]
181183
182184
185+
186+@Callable(i)
187+func claim (amount) = if ((i.caller.bytes != this.bytes))
188+ then throw("Only Owner Can Claim")
189+ else [ScriptTransfer(Address(claimAddr), amount, unit)]
190+
191+
183192 @Verifier(tx)
184193 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
185194
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxTokenAmountForPresale = 10000000
55
66 let tokenId = base58'4bzs2y3QjBq4GEMrNcydRLMX1ReRrJ223fxNXyqyNUXL'
7+
8+let claimAddr = base58'3N3fEf4mmVyYcbeuHYmZvXuJjoXjH5WRuEV'
79
810 let wvs = 100000000
911
1012 let tokenUnitPrice = 5
1113
1214 let denominator = 10000000
1315
1416 let decimalsInToken = 100
1517
1618 func tryGetInteger (key) = {
1719 let val = match getInteger(this, key) {
1820 case b: Int =>
1921 b
2022 case _ =>
2123 0
2224 }
2325 val
2426 }
2527
2628
2729 func tryGetString (key) = {
2830 let val = match getString(this, key) {
2931 case b: String =>
3032 b
3133 case _ =>
3234 ""
3335 }
3436 val
3537 }
3638
3739
3840 func tryGetBoolean (key) = match getBoolean(this, key) {
3941 case b: Boolean =>
4042 b
4143 case _ =>
4244 false
4345 }
4446
4547
4648 func getCurrentTokenAmountBoughtFromPresale (addr) = {
4749 let val = tryGetInteger((addr + "_tokenPresale"))
4850 val
4951 }
5052
5153
5254 func getRemainingPresaleTokenAmount () = {
5355 let val = match getInteger(this, "remainingPresaleTokenAmount") {
5456 case b: Int =>
5557 b
5658 case _ =>
5759 maxTokenAmountForPresale
5860 }
5961 val
6062 }
6163
6264
6365 func getPresaleStatus () = match getBoolean(this, "presaleStatus") {
6466 case b: Boolean =>
6567 b
6668 case _ =>
6769 true
6870 }
6971
7072
7173 func getTotalNftCount () = {
7274 let val = match getInteger(this, "totalNftCount") {
7375 case b: Int =>
7476 b
7577 case _ =>
7678 0
7779 }
7880 val
7981 }
8082
8183
8284 func getRemainingNftCount () = {
8385 let val = match getInteger(this, "remainingNftCount") {
8486 case b: Int =>
8587 b
8688 case _ =>
8789 0
8890 }
8991 val
9092 }
9193
9294
9395 func getRemainingNfts () = {
9496 let val = match getString(this, "remainingNfts") {
9597 case b: String =>
9698 b
9799 case _ =>
98100 ""
99101 }
100102 val
101103 }
102104
103105
104106 func getNftSoldOutOrNot (nftId) = match getBoolean(this, (nftId + "_soldOut")) {
105107 case b: Boolean =>
106108 b
107109 case _ =>
108110 false
109111 }
110112
111113
112114 func getRandomNumber (i) = {
113115 let rand = ((((i.transactionId + i.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
114116 sha256(rand)
115117 }
116118
117119
118120 @Callable(i)
119121 func buyTokensFromPresale (buyAmount) = {
120122 let callerAddress = toBase58String(i.caller.bytes)
121123 let pmt = value(i.payments[0])
122124 let amount = pmt.amount
123125 if (!(getPresaleStatus()))
124126 then throw("Presale Stopped by the Owner")
125127 else if ((buyAmount > getRemainingPresaleTokenAmount()))
126128 then throw("Exceeded Remaining Token Amount Dedicated for Presale")
127129 else if (((fraction(buyAmount, tokenUnitPrice, denominator) * wvs) > amount))
128130 then throw("Not enough payments in waves")
129131 else [IntegerEntry((callerAddress + "_tokenPresale"), (buyAmount + getCurrentTokenAmountBoughtFromPresale(callerAddress))), IntegerEntry("remainingPresaleTokenAmount", (getRemainingPresaleTokenAmount() - buyAmount)), StringEntry((callerAddress + "_presaleAddresses"), callerAddress), ScriptTransfer(value(addressFromString(callerAddress)), (buyAmount * decimalsInToken), tokenId)]
130132 }
131133
132134
133135
134136 @Callable(i)
135137 func mintNftByOwner (name,collectionId,metadata) = {
136138 let callerAddress = toBase58String(i.caller.bytes)
137139 if ((i.caller != this))
138140 then throw("Only Dapp Owner Can Mint")
139141 else {
140142 let nft = Issue(name, metadata, 1, 0, false)
141143 let nftId = calculateAssetId(nft)
142144 let nftIdStr = toBase58String(nftId)
143145 [nft, StringEntry((nftIdStr + "_assetId"), nftIdStr), StringEntry((nftIdStr + "_ownerAddr"), callerAddress), StringEntry(((nftIdStr + "_collectionId_") + collectionId), nftIdStr), StringEntry("remainingNfts", ((getRemainingNfts() + nftIdStr) + "_")), IntegerEntry("totalNftCount", (getTotalNftCount() + 1)), IntegerEntry("remainingNftCount", (getRemainingNftCount() + 1)), BooleanEntry((nftIdStr + "_soldOut"), false)]
144146 }
145147 }
146148
147149
148150
149151 @Callable(i)
150152 func buyNftsFromPresale () = {
151153 let callerAddress = toBase58String(i.caller.bytes)
152154 if (!(getPresaleStatus()))
153155 then throw("Presale Stopped by the Owner")
154156 else if ((getRemainingNftCount() == 0))
155157 then throw("Nfts are not available for buying - all are sold")
156158 else {
157159 let remainingNftList = split(getRemainingNfts(), "_")
158160 let remainingNftListSize = getRemainingNftCount()
159161 let rand = toInt(getRandomNumber(i))
160162 let position = (rand % remainingNftListSize)
161163 let selectedNftStr = remainingNftList[position]
162164 let updatedRemainingNftList = removeByIndex(remainingNftList, position)
163165 let updatedRemainingNftListAsString = makeString(updatedRemainingNftList, "_")
164166 [ScriptTransfer(value(addressFromString(callerAddress)), 1, fromBase58String(selectedNftStr)), StringEntry((selectedNftStr + "_ownerAddr"), callerAddress), IntegerEntry("remainingNftCount", (getRemainingNftCount() - 1)), StringEntry("remainingNfts", updatedRemainingNftListAsString), BooleanEntry((selectedNftStr + "_soldOut"), true)]
165167 }
166168 }
167169
168170
169171
170172 @Callable(i)
171173 func stopPresale () = if ((i.caller.bytes != this.bytes))
172174 then throw("Only Owner Can Stop the Presale")
173175 else [BooleanEntry("presaleStatus", false)]
174176
175177
176178
177179 @Callable(i)
178180 func reOpenPresale () = if ((i.caller.bytes != this.bytes))
179181 then throw("Only Owner Can Re-Open the Presale")
180182 else [BooleanEntry("presaleStatus", true)]
181183
182184
185+
186+@Callable(i)
187+func claim (amount) = if ((i.caller.bytes != this.bytes))
188+ then throw("Only Owner Can Claim")
189+ else [ScriptTransfer(Address(claimAddr), amount, unit)]
190+
191+
183192 @Verifier(tx)
184193 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
185194

github/deemru/w8io/026f985 
53.60 ms