tx · DzCd7V7HAQVDTTyduKdnwjAS2zSTaiji9XSasPhbtJbV

3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9:  -0.01400000 Waves

2022.01.10 19:17 [1873057] smart account 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9 > SELF 0.00000000 Waves

{ "type": 13, "id": "DzCd7V7HAQVDTTyduKdnwjAS2zSTaiji9XSasPhbtJbV", "fee": 1400000, "feeAssetId": null, "timestamp": 1641831473116, "version": 2, "chainId": 84, "sender": "3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9", "senderPublicKey": "HwnFy5MZJ9eyVKF9GSXN8nuA5uT2rcvnVqHw9vCv3DNn", "proofs": [ "6nby6j8guRjNBV548WUNT8RBcgupQSKvtSzy9AfherPbFijWKqen4nJmsZJeqEdJu6DEUr3WYou8gQu2E9Vaqag" ], "script": "base64:AAIFAAAAAAAAAiMIAhIAEgMKAQgSAwoBBBIAEgAaFAoBQRIPYWxyZWFkeVJlc2VydmVkGhQKAUISD3JlbWFpbmluZ1Rva2VucxoPCgFDEgpyZXNlcnZhYmxlGhUKAUQSEHJlbWFpbmluZ1Rva2VuczIaDQoBRRIIdG9SZWRlZW0aDgoBRhIJcmVtYWluaW5nGg8KAWESCnNoaW55d2dnaWQaEQoBYhIMYWRtaW5BZGRyZXNzGhcKAWMSEnByZXNhbGV0b2tlbmFtb3VudBoYCgFkEhNtYXhUb2tlbnNwZXJBZGRyZXNzGgkKAWUSBHVzZE4aEgoBZhINdHJ5R2V0SW50ZWdlchoICgFnEgNrZXkaDAoBaBIHJG1hdGNoMBoGCgFpEgFiGhIKAWoSDXRyeUdldEJvb2xlYW4aEgoBaxINaXNHYW1lU3RhcnRlZBoSCgFsEg1pc1doaXRlTGlzdGVkGg8KAW0SCmFkZHJlc3NTdHIaFgoBbhIRY2FsY1Rva2VudG9SZWRlZW0aCQoBbxIEYW1udBoQCgFwEgtzdGFydEhlaWdodBoNCgFxEghyZWRlZW1lZBo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AAAAFxBQAAAAFhBQAAAANuaWwJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAE3lvdSBjYW4gcmVkZWVtIG1heCAJAAGkAAAAAQUAAAABRgIAAAAGIFNIRUdHAAAAAGSlcsc=", "height": 1873057, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3tRD2kAddgKNrytVnVoi34vvRXNYXURj4i7rW77UksbD Next: 4iL5jmBbxnik4VbSWPCxUqr4SVsA1XTdQ7679zgtn3s2 Diff:
OldNewDifferences
134134 else {
135135 let toRedeem = calcTokentoRedeem(reservedAmount, addressStr)
136136 let remaining = (reservedAmount - redeemed)
137- if ((toRedeem >= remaining))
137+ if ((remaining >= toRedeem))
138138 then [IntegerEntry((addressStr + "_Redeemed"), (redeemed + toRedeem)), ScriptTransfer(i.caller, redeemed, shinywggid)]
139139 else throw((("you can redeem max " + toString(remaining)) + " SHEGG"))
140140 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf'
55
66 let adminAddress = addressFromStringValue("3N2fmsxjTetfnJBXEUpnALKcAQeNR4EizQQ")
77
88 let presaletokenamount = 50000000000000
99
1010 let maxTokensperAddress = 10000
1111
1212 let usdN = unit
1313
1414 func tryGetInteger (key) = match getInteger(this, key) {
1515 case b: Int =>
1616 b
1717 case _ =>
1818 0
1919 }
2020
2121
2222 func tryGetBoolean (key) = match getBoolean(this, key) {
2323 case b: Boolean =>
2424 b
2525 case _ =>
2626 false
2727 }
2828
2929
3030 func isGameStarted () = tryGetBoolean("Game_Started")
3131
3232
3333 func isWhiteListed (addressStr) = tryGetBoolean((addressStr + "_whiteListed"))
3434
3535
3636 func calcTokentoRedeem (amnt,addressStr) = {
3737 let startHeight = tryGetInteger("Start_Height")
3838 let redeemed = tryGetInteger((addressStr + "_Redeemed"))
3939 if ((startHeight == 0))
4040 then throw("Redeem time not started")
4141 else {
4242 let blocknum = (1440 * 180)
4343 if ((lastBlock.height > (startHeight + blocknum)))
4444 then (amnt - redeemed)
4545 else {
4646 let perblock = fraction(amnt, 1, blocknum)
4747 (((lastBlock.height - startHeight) * perblock) - redeemed)
4848 }
4949 }
5050 }
5151
5252
5353 @Callable(i)
5454 func init () = [IntegerEntry("Remaining_Tokens", presaletokenamount)]
5555
5656
5757
5858 @Callable(i)
5959 func addToWhiteList (addressStr) = if ((i.caller != this))
6060 then throw("you are not authorized to perform this operation")
6161 else [BooleanEntry((addressStr + "_whiteListed"), true)]
6262
6363
6464
6565 @Callable(i)
6666 func setStartGame (start) = if ((i.caller != this))
6767 then throw("you are not authorized to perform this operation")
6868 else [BooleanEntry("Game_Started", start), IntegerEntry("Start_Height", lastBlock.height)]
6969
7070
7171
7272 @Callable(i)
7373 func reserveTokens () = {
7474 let addressStr = toString(i.caller)
7575 let wl = isWhiteListed(addressStr)
7676 if (!(wl))
7777 then throw("you are not whitelisted!")
7878 else {
7979 let pmt = i.payments[0]
8080 if ((pmt == pmt))
8181 then {
8282 let amountIn = value(i.payments[0].amount)
8383 if ((amountIn == amountIn))
8484 then {
8585 let assetIn = pmt.assetId
8686 if ((assetIn == assetIn))
8787 then {
8888 let reservedAmount = amountIn
8989 if ((reservedAmount == reservedAmount))
9090 then {
9191 let alreadyReserved = tryGetInteger((addressStr + "_Reserved"))
9292 if ((alreadyReserved == alreadyReserved))
9393 then {
9494 let remainingTokens = tryGetInteger("Remaining_Tokens")
9595 if ((assetIn != usdN))
9696 then throw("ONLY USDN ALLOWED")
9797 else if ((0 >= remainingTokens))
9898 then throw("Presale is out of stock!")
9999 else if ((reservedAmount > remainingTokens))
100100 then throw((("You can reserve only" + toString(remainingTokens)) + " SHEGG"))
101101 else {
102102 let reservable = (maxTokensperAddress - alreadyReserved)
103103 if ((alreadyReserved > reservable))
104104 then throw((("You can reserve max " + toString(reservable)) + " SHEGG"))
105105 else {
106106 let remainingTokens2 = (remainingTokens - reservedAmount)
107107 [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + alreadyReserved)), IntegerEntry("Remaining_Tokens", remainingTokens2), ScriptTransfer(adminAddress, amountIn, usdN)]
108108 }
109109 }
110110 }
111111 else throw("Strict value is not equal to itself.")
112112 }
113113 else throw("Strict value is not equal to itself.")
114114 }
115115 else throw("Strict value is not equal to itself.")
116116 }
117117 else throw("Strict value is not equal to itself.")
118118 }
119119 else throw("Strict value is not equal to itself.")
120120 }
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func redeem () = if (!(isGameStarted()))
127127 then throw("Cannot redeem anything before the game starts!")
128128 else {
129129 let addressStr = toString(i.caller)
130130 let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
131131 let redeemed = tryGetInteger((addressStr + "_Redeemed"))
132132 if ((reservedAmount == 0))
133133 then throw("Nothing to redeem")
134134 else {
135135 let toRedeem = calcTokentoRedeem(reservedAmount, addressStr)
136136 let remaining = (reservedAmount - redeemed)
137- if ((toRedeem >= remaining))
137+ if ((remaining >= toRedeem))
138138 then [IntegerEntry((addressStr + "_Redeemed"), (redeemed + toRedeem)), ScriptTransfer(i.caller, redeemed, shinywggid)]
139139 else throw((("you can redeem max " + toString(remaining)) + " SHEGG"))
140140 }
141141 }
142142
143143

github/deemru/w8io/026f985 
24.74 ms