tx · GBEsR7beBYG8PLVnPJPMV3rU3E15oQDn6PmFSGLSEFVs

3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF:  -0.01000000 Waves

2021.09.28 14:40 [1722744] smart account 3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF > SELF 0.00000000 Waves

{ "type": 13, "id": "GBEsR7beBYG8PLVnPJPMV3rU3E15oQDn6PmFSGLSEFVs", "fee": 1000000, "feeAssetId": null, "timestamp": 1632829195900, "version": 2, "chainId": 84, "sender": "3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF", "senderPublicKey": "4RrGWbA8e8thBzBtEHyrov2WBWdwDG5KA2ZG76cJbjX8", "proofs": [ "5ZcHeXB3GFx37rkqZzo61UmBuZLWxk3EQCab1HTMdYdcMT51Fzs6U48wP4rzWVL1HrREdzWGQjnB754DrwMVARVk" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAHAAAAAAtmcm9lQXNzZXRJZAEAAAAgSsv1ZJ09Ny43QbbnBS7IGxI8mddY9Mw8h+wjzyuSMzUAAAAABm9uZURheQAAAAAAAAAFoAAAAAAPZGF5c1ZvdGVJc1ZhbGlkCQAAaAAAAAIFAAAABm9uZURheQAAAAAAAAAABwAAAAAXZGF5c1ZvdGVJc1ZhbGlkSW5CbG9ja3MJAABkAAAAAgUAAAAPZGF5c1ZvdGVJc1ZhbGlkBQAAAAZoZWlnaHQBAAAAFGluaXRpYWxXaXRoRHJhd3N0YXRlAAAAAAkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAOV2l0aGRyYXdfU3RhdGUCAAAACERJU0FCTEVEAQAAAA12b3RlcnNDb3VudGVyAAAAAQAAAAVpbmRleAQAAAAMaW5pdGlhbEluZGV4BQAAAAVpbmRleAUAAAAMaW5pdGlhbEluZGV4AQAAAA9jYWxjdWxhdGVSZXdhcmQAAAABAAAACnBlcmNlbnRhZ2UEAAAACnRvdGFsVmFsdWUEAAAAByRtYXRjaDAJAAQaAAAAAgUA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"applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J5fBwDduZKTgMqYnm4BCoYbWKiwVsdLkE8bzYhmw8v8t Next: F5xL3zwkzXmLdx9WQ2UieF8hU2R28oWL5KPyXRftGXyn Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let answersCount = 20
4+let froeAssetId = base58'62yYzfZL17bnZ2aPCuDoT1mfwick4PMHNooyAewfq8Sp'
55
6-let answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."]
6+let oneDay = 1440
77
8-func getAnswer (question,previousAnswer) = {
9- let hash = sha256(toBytes((question + previousAnswer)))
10- let index = toInt(hash)
11-answers[(index % answersCount)]
8+let daysVoteIsValid = (oneDay * 7)
9+
10+let daysVoteIsValidInBlocks = (daysVoteIsValid + height)
11+
12+func initialWithDrawstate () = StringEntry("Withdraw_State", "DISABLED")
13+
14+
15+func votersCounter (index) = {
16+ let initialIndex = index
17+ initialIndex
1218 }
1319
1420
15-func getPreviousAnswer (address) = match getString(this, (address + "_a")) {
16- case a: String =>
17- a
18- case _ =>
19- address
20-}
21+func calculateReward (percentage) = {
22+ let totalValue = match getInteger(this, "Total_vote_amount") {
23+ case val: Int =>
24+ val
25+ case _ =>
26+ 0
27+ }
28+ let percentageReward = (percentage / 100)
29+ let reward = (percentageReward * totalValue)
30+ reward
31+ }
2132
2233
2334 @Callable(i)
24-func tellme (question) = {
25- let callerAddress = toBase58String(i.caller.bytes)
26- let answer = getAnswer(question, getPreviousAnswer(callerAddress))
27- WriteSet([DataEntry((callerAddress + "_q"), question), DataEntry((callerAddress + "_a"), answer)])
35+func Vote () = {
36+ let pmt = if ((size(i.payments) == 1))
37+ then i.payments[0]
38+ else throw("You need exactly one froe to make a vote")
39+ let AddressOfVoter = toBase58String(i.caller.bytes)
40+ let currentvalue = match getInteger(this, "Total_vote_amount") {
41+ case t: Int =>
42+ t
43+ case _ =>
44+ 0
45+ }
46+ let checkVoter = match getInteger(this, ("Vote_Amount_For" + AddressOfVoter)) {
47+ case c: Int =>
48+ c
49+ case _ =>
50+ unit
51+ }
52+ let votersIndex = match getInteger(this, "Vote_Index") {
53+ case a: Int =>
54+ a
55+ case _ =>
56+ 0
57+ }
58+ let rewardValue = calculateReward(81)
59+ if ((checkVoter != unit))
60+ then throw("You already Voted")
61+ else if ((pmt.assetId != froeAssetId))
62+ then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only."))
63+ else if ((10000 != pmt.amount))
64+ then throw("Exactly 1 Froe is need to make a vote")
65+ else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1)), IntegerEntry("Total_vote_amount", (currentvalue + pmt.amount)), IntegerEntry("Voting_Reward", rewardValue)]
2866 }
2967
68+
69+
70+@Callable(i)
71+func Withdraw () = {
72+ let checkWithDrawState = getStringValue("Withdraw_State")
73+ let AddressOfVoter = toBase58String(i.caller.bytes)
74+ let reward = calculateReward(81)
75+ let checkValidVote = getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter))
76+ if ((checkWithDrawState == "DISABLED"))
77+ then throw("Withdrawal Is currently disabled. A minimum of 7 Days is need for eligible withdrawals")
78+ else if ((checkValidVote == 0))
79+ then throw("No Valid Vote Found")
80+ else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) + reward), froeAssetId)]
81+ }
82+
83+
84+@Verifier(tx)
85+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
3086

github/deemru/w8io/026f985 
31.09 ms