tx · F5xL3zwkzXmLdx9WQ2UieF8hU2R28oWL5KPyXRftGXyn

3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF:  -0.05000000 Waves

2021.09.29 16:17 [1724293] smart account 3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF > SELF 0.00000000 Waves

{ "type": 13, "id": "F5xL3zwkzXmLdx9WQ2UieF8hU2R28oWL5KPyXRftGXyn", "fee": 5000000, "feeAssetId": null, "timestamp": 1632921432149, "version": 2, "chainId": 84, "sender": "3NCVp18FAUoyhqmpShGvFPUZ9GVXub79QqF", "senderPublicKey": "4RrGWbA8e8thBzBtEHyrov2WBWdwDG5KA2ZG76cJbjX8", "proofs": [ "4Z8BZqok8H9KcjjB9N6RA871kfZZXPSZCY7uTRYxYtZ2GGvonzj6MeqJUChsN681JnQ3vbqjUVLepaeseCD4o5NH" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAIAAAAAAtmcm9lQXNzZXRJZAEAAAAgSsv1ZJ09Ny43QbbnBS7IGxI8mddY9Mw8h+wjzyuSMzUAAAAABm9uZURheQAAAAAAAAAFoAAAAAAPZGF5c1ZvdGVJc1ZhbGlkCQAAaAAAAAIFAAAABm9uZURheQAAAAAAAAAABwAAAAAXZGF5c1ZvdGVJc1ZhbGlkSW5CbG9ja3MJAABkAAAAAgUAAAAPZGF5c1ZvdGVJc1ZhbGlkBQAAAAZoZWlnaHQAAAAACmdyYW5kVG90YWwJAAPwAAAAAgUAAAAEdGhpcwUAAAALZnJvZUFzc2V0SWQBAAAAFGluaXRpYWxXaXRoRHJhd3N0YXRlAAAAAAkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAOV2l0aGRyYXdfU3RhdGUCAAAACERJU0FCTEVEAQAAAA12b3RlcnNDb3VudGVyAAAAAQAAAAVpbmRleAQAAAAMaW5pdGlhbEluZGV4BQAAAAVpbmRleAUAAAAMaW5pdGlhbEluZGV4AQAAAA9jYWxjdWxhdGVSZXdhcmQAAAABAAAAC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AABRBAAAAA5jaGVja1ZhbGlkVm90ZQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAA9Wb3RlX0Ftb3VudF9Gb3IFAAAADkFkZHJlc3NPZlZvdGVyAwkAAAAAAAACBQAAABJjaGVja1dpdGhEcmF3U3RhdGUCAAAACERJU0FCTEVECQAAAgAAAAECAAAAV1dpdGhkcmF3YWwgSXMgY3VycmVudGx5IGRpc2FibGVkLiBBIG1pbmltdW0gIG9mIDcgRGF5cyBpcyBuZWVkIGZvciBlbGlnaWJsZSB3aXRoZHJhd2FscwMJAAAAAAAAAgUAAAAOY2hlY2tWYWxpZFZvdGUAAAAAAAAAAAAJAAACAAAAAQIAAAATTm8gVmFsaWQgVm90ZSBGb3VuZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIJAABkAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAA9Wb3RlX0Ftb3VudF9Gb3IFAAAADkFkZHJlc3NPZlZvdGVyBQAAAAZyZXdhcmQFAAAAC2Zyb2VBc3NldElkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlebSYlgE=", "height": 1724293, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GBEsR7beBYG8PLVnPJPMV3rU3E15oQDn6PmFSGLSEFVs Next: 5UtSetHduvm2WkQVDLwUYghJybjEbHThgwLxc8VP7GyD Diff:
OldNewDifferences
99
1010 let daysVoteIsValidInBlocks = (daysVoteIsValid + height)
1111
12+let grandTotal = assetBalance(this, froeAssetId)
13+
1214 func initialWithDrawstate () = StringEntry("Withdraw_State", "DISABLED")
1315
1416
1921
2022
2123 func calculateReward (percentage) = {
22- let totalValue = match getInteger(this, "Total_vote_amount") {
23- case val: Int =>
24- val
25- case _ =>
26- 0
27- }
2824 let percentageReward = (percentage / 100)
29- let reward = (percentageReward * totalValue)
25+ let reward = (percentageReward * grandTotal)
3026 reward
3127 }
3228
6258 then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only."))
6359 else if ((10000 != pmt.amount))
6460 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)]
61+ else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1)), IntegerEntry("Voting_Reward", rewardValue)]
6662 }
6763
6864
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let froeAssetId = base58'62yYzfZL17bnZ2aPCuDoT1mfwick4PMHNooyAewfq8Sp'
55
66 let oneDay = 1440
77
88 let daysVoteIsValid = (oneDay * 7)
99
1010 let daysVoteIsValidInBlocks = (daysVoteIsValid + height)
1111
12+let grandTotal = assetBalance(this, froeAssetId)
13+
1214 func initialWithDrawstate () = StringEntry("Withdraw_State", "DISABLED")
1315
1416
1517 func votersCounter (index) = {
1618 let initialIndex = index
1719 initialIndex
1820 }
1921
2022
2123 func calculateReward (percentage) = {
22- let totalValue = match getInteger(this, "Total_vote_amount") {
23- case val: Int =>
24- val
25- case _ =>
26- 0
27- }
2824 let percentageReward = (percentage / 100)
29- let reward = (percentageReward * totalValue)
25+ let reward = (percentageReward * grandTotal)
3026 reward
3127 }
3228
3329
3430 @Callable(i)
3531 func Vote () = {
3632 let pmt = if ((size(i.payments) == 1))
3733 then i.payments[0]
3834 else throw("You need exactly one froe to make a vote")
3935 let AddressOfVoter = toBase58String(i.caller.bytes)
4036 let currentvalue = match getInteger(this, "Total_vote_amount") {
4137 case t: Int =>
4238 t
4339 case _ =>
4440 0
4541 }
4642 let checkVoter = match getInteger(this, ("Vote_Amount_For" + AddressOfVoter)) {
4743 case c: Int =>
4844 c
4945 case _ =>
5046 unit
5147 }
5248 let votersIndex = match getInteger(this, "Vote_Index") {
5349 case a: Int =>
5450 a
5551 case _ =>
5652 0
5753 }
5854 let rewardValue = calculateReward(81)
5955 if ((checkVoter != unit))
6056 then throw("You already Voted")
6157 else if ((pmt.assetId != froeAssetId))
6258 then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only."))
6359 else if ((10000 != pmt.amount))
6460 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)]
61+ else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For" + AddressOfVoter), pmt.amount), IntegerEntry("Vote_Index", (votersIndex + 1)), IntegerEntry("Voting_Reward", rewardValue)]
6662 }
6763
6864
6965
7066 @Callable(i)
7167 func Withdraw () = {
7268 let checkWithDrawState = getStringValue("Withdraw_State")
7369 let AddressOfVoter = toBase58String(i.caller.bytes)
7470 let reward = calculateReward(81)
7571 let checkValidVote = getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter))
7672 if ((checkWithDrawState == "DISABLED"))
7773 then throw("Withdrawal Is currently disabled. A minimum of 7 Days is need for eligible withdrawals")
7874 else if ((checkValidVote == 0))
7975 then throw("No Valid Vote Found")
8076 else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For" + AddressOfVoter)) + reward), froeAssetId)]
8177 }
8278
8379
8480 @Verifier(tx)
8581 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
8682

github/deemru/w8io/026f985 
44.52 ms