tx · 24T724h9MUjHFmPvtz9cBbWGrvuzFVmSyf6P9V9oTX5J

3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9:  -0.01400000 Waves

2022.01.10 17:27 [1872944] smart account 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9 > SELF 0.00000000 Waves

{ "type": 13, "id": "24T724h9MUjHFmPvtz9cBbWGrvuzFVmSyf6P9V9oTX5J", "fee": 1400000, "feeAssetId": null, "timestamp": 1641824894066, "version": 2, "chainId": 84, "sender": "3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9", "senderPublicKey": "HwnFy5MZJ9eyVKF9GSXN8nuA5uT2rcvnVqHw9vCv3DNn", "proofs": [ "22iEGt72c4jtqFSQhJrtNxv2EdsvfXqJHNWqXN2KS9ceEqPhE8kgvhxMzdGvKq3NGsjHPiGi8QcaMwLCx3ev29nc" ], "script": "base64:AAIFAAAAAAAAAbEIAhIAEgMKAQgSAwoBBBIAEgAaDwoBYRIKc2hpbnl3Z2dpZBoRCgFiEgxhZG1pbkFkZHJlc3MaFwoBYxIScHJlc2FsZXRva2VuYW1vdW50GhgKAWQSE21heFRva2Vuc3BlckFkZHJlc3MaCQoBZRIEdXNkThoSCgFmEg10cnlHZXRJbnRlZ2VyGggKAWcSA2tleRoMCgFoEgckbWF0Y2gwGgYKAWkSAWIaEgoBahINdHJ5R2V0Qm9vbGVhbhoSCgFrEg1pc0dhbWVTdGFydGVkGhIKAWwSDWlzV2hpdGVMaXN0ZWQaDwoBbRIKYWRkcmVzc1N0choGCgFuEgFpGgoKAW8SBXN0YXJ0GgcKAXASAndsGggKAXESA3BtdBoNCgFyEghhbW91bnRJbhoMCgFzEgdhc3NldEluGhMKAXQSDnJlc2VydmVkQW1vdW50GhQKAXUSD2FscmVhZHlSZXNlcnZlZBoUCgF2Eg9yZW1haW5pbmdUb2tlbnMaDwoBdxIKcmVzZXJ2YWJsZRoVCgF4EhByZW1haW5pbmdUb2tlbnMyGg0KAXkS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AAgAAAAECAAAAEU5vdGhpbmcgdG8gcmVkZWVtBAAAAAF5BQAAAAF0CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAAAW0CAAAACV9SZXNlcnZlZAkAAGUAAAACBQAAAAF0BQAAAAF5CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFuAAAABmNhbGxlcgUAAAABeQUAAAABYQUAAAADbmlsAAAAAEpVrhs=", "height": 1872944, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CMpHpL2Q3XU5N77R63XpHfW7ojg1XtU4thZCZZqrVQeY Next: EaRcG4nb1WzmggqDbJSKxF55veTm9rfk7m1ZquczE8Fw Diff:
OldNewDifferences
104104 }
105105
106106
107+
108+@Callable(i)
109+func redeem () = if (!(isGameStarted()))
110+ then throw("Cannot redeem anything before the game starts!")
111+ else {
112+ let addressStr = toString(i.caller)
113+ let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
114+ if ((reservedAmount == 0))
115+ then throw("Nothing to redeem")
116+ else {
117+ let redeemed = reservedAmount
118+[IntegerEntry((addressStr + "_Reserved"), (reservedAmount - redeemed)), ScriptTransfer(i.caller, redeemed, shinywggid)]
119+ }
120+ }
121+
122+
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 @Callable(i)
3737 func init () = [IntegerEntry("Remaining_Tokens", presaletokenamount)]
3838
3939
4040
4141 @Callable(i)
4242 func addToWhiteList (addressStr) = if ((i.caller != this))
4343 then throw("you are not authorized to perform this operation")
4444 else [BooleanEntry((addressStr + "_whiteListed"), true)]
4545
4646
4747
4848 @Callable(i)
4949 func setStartGame (start) = if ((i.caller != this))
5050 then throw("you are not authorized to perform this operation")
5151 else [BooleanEntry("Game_Started", start)]
5252
5353
5454
5555 @Callable(i)
5656 func reserveTokens () = {
5757 let addressStr = toString(i.caller)
5858 let wl = isWhiteListed(addressStr)
5959 if (!(wl))
6060 then throw("you are not whitelisted!")
6161 else {
6262 let pmt = i.payments[0]
6363 if ((pmt == pmt))
6464 then {
6565 let amountIn = value(i.payments[0].amount)
6666 if ((amountIn == amountIn))
6767 then {
6868 let assetIn = pmt.assetId
6969 if ((assetIn == assetIn))
7070 then {
7171 let reservedAmount = amountIn
7272 if ((reservedAmount == reservedAmount))
7373 then {
7474 let alreadyReserved = tryGetInteger((addressStr + "_Reserved"))
7575 if ((alreadyReserved == alreadyReserved))
7676 then {
7777 let remainingTokens = tryGetInteger("Remaining_Tokens")
7878 if ((assetIn != usdN))
7979 then throw("ONLY USDN ALLOWED")
8080 else if ((0 >= remainingTokens))
8181 then throw("Presale is out of stock!")
8282 else if ((reservedAmount > remainingTokens))
8383 then throw((("You can reserve only" + toString(remainingTokens)) + " SHEGG"))
8484 else {
8585 let reservable = (maxTokensperAddress - alreadyReserved)
8686 if ((alreadyReserved > reservable))
8787 then throw((("You can reserve max " + toString(reservable)) + " SHEGG"))
8888 else {
8989 let remainingTokens2 = (remainingTokens - reservedAmount)
9090 [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + alreadyReserved)), IntegerEntry("Remaining_Tokens", remainingTokens2), ScriptTransfer(adminAddress, amountIn, usdN)]
9191 }
9292 }
9393 }
9494 else throw("Strict value is not equal to itself.")
9595 }
9696 else throw("Strict value is not equal to itself.")
9797 }
9898 else throw("Strict value is not equal to itself.")
9999 }
100100 else throw("Strict value is not equal to itself.")
101101 }
102102 else throw("Strict value is not equal to itself.")
103103 }
104104 }
105105
106106
107+
108+@Callable(i)
109+func redeem () = if (!(isGameStarted()))
110+ then throw("Cannot redeem anything before the game starts!")
111+ else {
112+ let addressStr = toString(i.caller)
113+ let reservedAmount = tryGetInteger((addressStr + "_Reserved"))
114+ if ((reservedAmount == 0))
115+ then throw("Nothing to redeem")
116+ else {
117+ let redeemed = reservedAmount
118+[IntegerEntry((addressStr + "_Reserved"), (reservedAmount - redeemed)), ScriptTransfer(i.caller, redeemed, shinywggid)]
119+ }
120+ }
121+
122+

github/deemru/w8io/026f985 
28.20 ms