tx · 38Mkx5bemM5F9XRVx5qRc6Qr63qWnxW5D9AE2Bg23L9u

3N7hJu27qmD5Xtvi6DPkwYzQyvtYEH2WhuE:  -0.01400000 Waves

2021.10.01 15:21 [1727119] smart account 3N7hJu27qmD5Xtvi6DPkwYzQyvtYEH2WhuE > SELF 0.00000000 Waves

{ "type": 13, "id": "38Mkx5bemM5F9XRVx5qRc6Qr63qWnxW5D9AE2Bg23L9u", "fee": 1400000, "feeAssetId": null, "timestamp": 1633090949188, "version": 1, "sender": "3N7hJu27qmD5Xtvi6DPkwYzQyvtYEH2WhuE", "senderPublicKey": "HoK9nfY6HDBaSSrV6qGhf3m38Ym2fMP1YmwaTNM5uGAu", "proofs": [ "E9ygNj14ufUxARocEUn932d86j3kFWJPwh6twZP93RFogYeqnh6mGoJb2SbwXCuZ3Z2g7Bajs5Jx13ALvGPxcea" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAHAAAAAAtmcm9lQXNzZXRJZAEAAAAgSsv1ZJ09Ny43QbbnBS7IGxI8mddY9Mw8h+wjzyuSMzUAAAAABm9uZURheQAAAAAAAAAFoAAAAAAPZGF5c1ZvdGVJc1ZhbGlkCQAAaAAAAAIFAAAABm9uZURheQAAAAAAAAAABwAAAAAXZGF5c1ZvdGVJc1ZhbGlkSW5CbG9ja3MJAABkAAAAAgUAAAAPZGF5c1ZvdGVJc1ZhbGlkBQAAAAZoZWlnaHQAAAAACmdyYW5kVG90YWwJAAPwAAAAAgUAAAAEdGhpcwUAAAALZnJvZUFzc2V0SWQAAAAACGJhc2VVbml0AAAAAAAAACcQAQAAAA9jYWxjdWxhdGVSZXdhcmQAAAABAAAACnBlcmNlbnRhZ2UEAAAAFWNvbnZlcnRlcmVkUGVyY2VudGFnZQkAAGgAAAACBQAAAApwZXJjZW50YWdlBQAAAAhiYXNlVW5pdAQAAAAQcGVyY2VudGFnZVJld2FyZAkAAGsAAAADBQAAAApncmFuZFRvdGFsBQAAAApwZXJjZW50YWdlCQAAaA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JpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleZHrUxo=", "chainId": 84, "height": 1727119, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HuY6jZKZD3ghtRdaRkNeVyrub94wWxZi3ADheAEDtY3K Next: BzXoihYdXTyAqSn8anPv1csj9qWKihs9VZwQPxbSSFo5 Diff:
OldNewDifferences
1111
1212 let grandTotal = assetBalance(this, froeAssetId)
1313
14+let baseUnit = 10000
15+
1416 func calculateReward (percentage) = {
15- let percentageReward = ((grandTotal * percentage) / 1000000)
16- let reward = (percentageReward / grandTotal)
17+ let converteredPercentage = (percentage * baseUnit)
18+ let percentageReward = fraction(grandTotal, percentage, (100 * baseUnit))
19+ let reward = fraction(percentageReward, baseUnit, grandTotal)
1720 reward
1821 }
1922
7982 then throw("Withdrawal Is currently disabled. A minimum of 30 Days is needed for eligible withdrawals")
8083 else if ((checkValidVote == 0))
8184 then throw("No Valid Vote Found")
82- else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + (reward * 10000)), froeAssetId), IntegerEntry("Reward due Voter", reward)]
85+ else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + reward), froeAssetId), StringEntry("Reward due Voter", toString(reward))]
8386 }
8487
8588
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
1212 let grandTotal = assetBalance(this, froeAssetId)
1313
14+let baseUnit = 10000
15+
1416 func calculateReward (percentage) = {
15- let percentageReward = ((grandTotal * percentage) / 1000000)
16- let reward = (percentageReward / grandTotal)
17+ let converteredPercentage = (percentage * baseUnit)
18+ let percentageReward = fraction(grandTotal, percentage, (100 * baseUnit))
19+ let reward = fraction(percentageReward, baseUnit, grandTotal)
1720 reward
1821 }
1922
2023
2124 @Callable(i)
2225 func Vote () = {
2326 let pmt = if ((size(i.payments) == 1))
2427 then i.payments[0]
2528 else throw("You need exactly one froe to make a vote")
2629 let AddressOfVoter = toBase58String(i.caller.bytes)
2730 let currentvalue = match getInteger(this, "Total_vote_amount") {
2831 case t: Int =>
2932 t
3033 case _ =>
3134 0
3235 }
3336 let checkVoter = match getInteger(this, ("Vote_Amount_For_" + AddressOfVoter)) {
3437 case c: Int =>
3538 c
3639 case _ =>
3740 unit
3841 }
3942 let votersIndex = match getInteger(this, "Voter_Index") {
4043 case a: Int =>
4144 a
4245 case _ =>
4346 0
4447 }
4548 let voteState = match getString(this, "Vote_State") {
4649 case v: String =>
4750 v
4851 case _ =>
4952 unit
5053 }
5154 let rewardValue = calculateReward(81)
5255 if ((pmt.assetId != froeAssetId))
5356 then throw((("Incorrect asset attached, please attach " + toBase58String(froeAssetId)) + " only."))
5457 else if (if ((voteState != unit))
5558 then (voteState == "DISABLED")
5659 else false)
5760 then throw("Voting is currently disable")
5861 else if ((checkVoter != unit))
5962 then throw("You already Voted")
6063 else if ((10000 != pmt.amount))
6164 then throw("Exactly 1 Froe is need to make a vote")
6265 else [StringEntry("Voter", AddressOfVoter), IntegerEntry(("Vote_Amount_For_" + AddressOfVoter), pmt.amount), IntegerEntry("Voter_Index", (votersIndex + 1))]
6366 }
6467
6568
6669
6770 @Callable(i)
6871 func Withdraw () = {
6972 let checkWithDrawState = getStringValue("Withdraw_State")
7073 let AddressOfVoter = toBase58String(i.caller.bytes)
7174 let reward = calculateReward(81)
7275 let checkValidVote = match getInteger(this, ("Vote_Amount_For_" + AddressOfVoter)) {
7376 case val: Int =>
7477 val
7578 case _ =>
7679 0
7780 }
7881 if ((checkWithDrawState == "DISABLED"))
7982 then throw("Withdrawal Is currently disabled. A minimum of 30 Days is needed for eligible withdrawals")
8083 else if ((checkValidVote == 0))
8184 then throw("No Valid Vote Found")
82- else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + (reward * 10000)), froeAssetId), IntegerEntry("Reward due Voter", reward)]
85+ else [ScriptTransfer(i.caller, (getIntegerValue(this, ("Vote_Amount_For_" + AddressOfVoter)) + reward), froeAssetId), StringEntry("Reward due Voter", toString(reward))]
8386 }
8487
8588
8689 @Verifier(tx)
8790 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
8891

github/deemru/w8io/026f985 
39.51 ms