tx · FDMsfhsuZi2tm5SDvhD3tPWmnSNHLM7W1gMnLzV2H53v

3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs:  -0.01000000 Waves

2023.09.07 11:56 [2744752] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves

{ "type": 13, "id": "FDMsfhsuZi2tm5SDvhD3tPWmnSNHLM7W1gMnLzV2H53v", "fee": 1000000, "feeAssetId": null, "timestamp": 1694077015983, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "2c7ad7wuLDRG7ioTexfRXGEdjwnvQzoBZxx9z295a88x45J8QjQiYLmom1YfiA1tSXKY53YSEagJ7KQeLu1nyeN8" ], "script": "base64:BgIfCAISABIECgIIARIGCgQIAQEIEgQKAggBEgUKAwgBCBIADmxvdHRlcnlBc3NldElEASAi1eE3pAm1kH7yDd2K/R2HDGQ6c8cmK+ceUzFNVsLOiQEQZ2V0SW50ZWdlck9yRWxzZQIDa2V5A3ZhbAkBC3ZhbHVlT3JFbHNlAgkAnwgBBQNrZXkFA3ZhbAEPZ2V0U3RyaW5nT3JFbHNlAgNrZXkDdmFsCQELdmFsdWVPckVsc2UCCQCiCAEFA2tleQUDdmFsAQ9zdHJpbmdLZXlFeGlzdHMBA2tleQMJAQlpc0RlZmluZWQBCQCiCAEFA2tleQYHAQJtawEBeAkAuQkCBQF4AgFfARVrZXlMb3R0ZXJ5VG90YWxTdGFrZWQBC2xvdHRlcnlOYW1lCQECbWsBCQDMCAICB2xvdHRlcnkJAMwIAgULbG90dGVyeU5hbWUJAMwIAgILdG90YWxTdGFrZWQFA25pbAETa2V5TG90dGVyeUFkclN0YWtlZAILbG90dGVyeU5hbWUDYWRyCQECbWsBCQDMCAICB2xvdHRlcnkJAMwIAgULbG90dGVyeU5hbWUJAMwIAg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EJpTykPrbJP81GPE9St88paLte Diff:
OldNewDifferences
9696 @Callable(i)
9797 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
9898 then throw("Admin only")
99- else [StringEntry(_activeLotteryName, lotteryName), IntegerEntry(keyLotteryFinalHeight(lotteryName), lotteryFinalHeight)]
99+ else [StringEntry(_activeLotteryName, lotteryName), IntegerEntry(keyLotteryStartHeight(lotteryName), height), IntegerEntry(keyLotteryFinalHeight(lotteryName), lotteryFinalHeight)]
100100
101101
102102
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lotteryAssetID = base58'3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q'
55
66 func getIntegerOrElse (key,val) = valueOrElse(getInteger(key), val)
77
88
99 func getStringOrElse (key,val) = valueOrElse(getString(key), val)
1010
1111
1212 func stringKeyExists (key) = if (isDefined(getString(key)))
1313 then true
1414 else false
1515
1616
1717 func mk (x) = makeString(x, "_")
1818
1919
2020 func keyLotteryTotalStaked (lotteryName) = mk(["lottery", lotteryName, "totalStaked"])
2121
2222
2323 func keyLotteryAdrStaked (lotteryName,adr) = mk(["lottery", lotteryName, "adr", adr, "staked"])
2424
2525
2626 func keyLotteryAdrLocked (lotteryName,adr) = mk(["lottery", lotteryName, "adr", adr, "locked"])
2727
2828
2929 func keyLotteryFinalHeight (lotteryName) = mk(["lottery", lotteryName, "finalHeight"])
3030
3131
3232 func keyLotteryStartHeight (lotteryName) = mk(["lottery", lotteryName, "startHeight"])
3333
3434
3535 func keyLotteryPrizeValue (lotteryName,prizeID) = mk(["lottery", lotteryName, "prize", toString(prizeID), "value"])
3636
3737
3838 func keyLotteryPrizeThreshold (lotteryName,prizeID) = mk(["lottery", lotteryName, "prize", toString(prizeID), "threshold"])
3939
4040
4141 func keyLotteryPrizeRandom (lotteryName,prizeID) = mk(["lottery", lotteryName, "prize", toString(prizeID), "random"])
4242
4343
4444 func keyLotteryPrizeWinner (lotteryName,prizeID) = mk(["lottery", lotteryName, "prize", toString(prizeID), "winner"])
4545
4646
4747 func keyLotteryTicketsOwner (lotteryName,from,to) = mk(["lottery", lotteryName, "from", toString(from), "to", toString(to), "owner"])
4848
4949
5050 let _activeLotteryName = mk(["param", "activeLotteryName"])
5151
5252 let _globalTotalStaked = mk(["param", "globalTotalStaked"])
5353
5454 func activeLotteryName () = {
5555 let lotteryName = getStringOrElse(_activeLotteryName, "")
5656 if ((lotteryName == ""))
5757 then ""
5858 else {
5959 let lotteryFinalHeight = getIntegerValue(keyLotteryFinalHeight(lotteryName))
6060 if ((height >= lotteryFinalHeight))
6161 then ""
6262 else lotteryName
6363 }
6464 }
6565
6666
6767 @Callable(i)
6868 func stake () = {
6969 let lotteryName = activeLotteryName()
7070 if ((lotteryName == ""))
7171 then throw("Lottery not active")
7272 else if ((size(i.payments) == 0))
7373 then throw("No payment added. You must attach a payment in Dodllnode tokens")
7474 else if ((size(i.payments) != 1))
7575 then throw("Too many payments added. There must be only one attached payment")
7676 else if ((i.payments[0].assetId != lotteryAssetID))
7777 then throw("Wrong payment assetID. You must attach a payment in Dodllnode tokens")
7878 else {
7979 let amount = i.payments[0].amount
8080 if ((1 > amount))
8181 then throw("Not enough payment to purchase even a single ticket.")
8282 else {
8383 let callerAddress = toString(i.caller)
8484 let _lotteryTotalStaked = keyLotteryTotalStaked(lotteryName)
8585 let lotteryTotalStaked = getIntegerOrElse(_lotteryTotalStaked, 0)
8686 let _lotteryAdrStaked = keyLotteryAdrStaked(lotteryName, callerAddress)
8787 let lotteryAdrStaked = getIntegerOrElse(_lotteryAdrStaked, 0)
8888 let _owner = keyLotteryTicketsOwner(lotteryName, lotteryTotalStaked, ((lotteryTotalStaked + amount) - 1))
8989 [IntegerEntry(_lotteryTotalStaked, (lotteryTotalStaked + amount)), IntegerEntry(_lotteryAdrStaked, (lotteryAdrStaked + amount)), StringEntry(_owner, callerAddress)]
9090 }
9191 }
9292 }
9393
9494
9595
9696 @Callable(i)
9797 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
9898 then throw("Admin only")
99- else [StringEntry(_activeLotteryName, lotteryName), IntegerEntry(keyLotteryFinalHeight(lotteryName), lotteryFinalHeight)]
99+ else [StringEntry(_activeLotteryName, lotteryName), IntegerEntry(keyLotteryStartHeight(lotteryName), height), IntegerEntry(keyLotteryFinalHeight(lotteryName), lotteryFinalHeight)]
100100
101101
102102
103103 @Callable(i)
104104 func declarePrize (lotteryName,prizeId,prizeThreshold,prizeValue) = if ((i.caller != this))
105105 then throw("Admin only")
106106 else [IntegerEntry(keyLotteryPrizeThreshold(lotteryName, prizeId), prizeThreshold), StringEntry(keyLotteryPrizeValue(lotteryName, prizeId), prizeValue)]
107107
108108
109109
110110 @Callable(i)
111111 func finalaizePrizeRandom (lotteryName,prizeId) = if ((i.caller != this))
112112 then throw("Admin only")
113113 else {
114114 let lotteryFinalHeight = getIntegerValue(keyLotteryFinalHeight(lotteryName))
115115 if (((lotteryFinalHeight + 1) > height))
116116 then throw("Lottery is not over yet")
117117 else {
118118 let lotteryPrizeValue = valueOrErrorMessage(getString(keyLotteryPrizeValue(lotteryName, prizeId)), "Prize does not exist")
119119 let _lotteryPrizeRandom = keyLotteryPrizeRandom(lotteryName, prizeId)
120120 if (stringKeyExists(_lotteryPrizeRandom))
121121 then throw("The prize random has already been finalaized")
122122 else {
123123 let finalBlock0 = value(blockInfoByHeight(lotteryFinalHeight))
124124 let finalBlock1 = value(blockInfoByHeight((lotteryFinalHeight + 1)))
125125 let prizeRandomRaw = toBigInt(sha256((((base58'2WWKxchwx7zBB' + toBytes(prizeId)) + value(finalBlock0.vrf)) + value(finalBlock1.vrf))))
126126 let prizeRandom = if ((toBigInt(0) > prizeRandomRaw))
127127 then -(prizeRandomRaw)
128128 else prizeRandomRaw
129129 [StringEntry(_lotteryPrizeRandom, toString(prizeRandom))]
130130 }
131131 }
132132 }
133133
134134
135135
136136 @Callable(i)
137137 func finalaizePrizeWinner (lotteryName,prizeId,winnerAdr) = if ((i.caller != this))
138138 then throw("Admin only")
139139 else {
140140 let _lotteryPrizeWinner = keyLotteryPrizeWinner(lotteryName, prizeId)
141141 if (stringKeyExists(_lotteryPrizeWinner))
142142 then throw("The prize winner has already been finalaized")
143143 else {
144144 let _lotteryAdrStaked = keyLotteryAdrStaked(lotteryName, winnerAdr)
145145 let lotteryAdrStaked = getIntegerOrElse(_lotteryAdrStaked, 0)
146146 let _lotteryAdrLocked = keyLotteryAdrLocked(lotteryName, winnerAdr)
147147 let lotteryAdrLocked = getIntegerOrElse(_lotteryAdrLocked, 0)
148148 [IntegerEntry(_lotteryAdrStaked, 0), IntegerEntry(_lotteryAdrLocked, (lotteryAdrLocked + lotteryAdrStaked)), StringEntry(_lotteryPrizeWinner, winnerAdr)]
149149 }
150150 }
151151
152152
153153 @Verifier(tx)
154154 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
155155

github/deemru/w8io/026f985 
33.41 ms