tx · 5FA22RKW1a4tye6Tw711c9K1z1hJqq3WBJjTBH8EjSXS
3N17JMn4WESkhCSrcEwdADBZFAe8uiuvCGQ: -0.01400000 Waves
2021.09.21 20:22 [1713103] smart account 3N17JMn4WESkhCSrcEwdADBZFAe8uiuvCGQ > SELF 0.00000000 Waves
{
"type": 13,
"id": "5FA22RKW1a4tye6Tw711c9K1z1hJqq3WBJjTBH8EjSXS",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1632245045956,
"version": 2,
"chainId": 84,
"sender": "3N17JMn4WESkhCSrcEwdADBZFAe8uiuvCGQ",
"senderPublicKey": "BMLuSYJ8rvQD55waCoKpzCBhJAbY8s9pp4V5ZgxuzCBD",
"proofs": [
"B5P4bRsfth92Rbj1BE1RLw46N1XyEhxR83J7TX2Tbfyc38VWeSFhYYnyiBmL4y1yGw366RGZdWzBcjKrHTBYqRZ"
],
"script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAAAgAAAAAKQTRBQXNzZXRJRAEAAAAg/sQa4d7v52kifRLo73ftXd9xD7wgh9JaaHT98W4IWDcAAAAAC1VTRFRBc3NldElEAQAAACAIZYS3D/CKahrz4mjoLgiQJMPTJ1gDzSz2Ll4L39oVpAAAAAEAAAABaQEAAAAEVm90ZQAAAAEAAAAORmF2b3VyaXRlQXNzZXQEAAAAA3BtdAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAADQwLjAwMDEgQTRBIFRva2VuIGlzIHJlcXVpcmVkIGFzIEF0dGFjaGVkIHBheW1lbnRbMV0uBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAC1dlZWswSGVpZ2h0AAAAAAAAGfPyBAAAAAhlYWNod2VlawAAAAAAAAAnYAQAAAASY3VycmVudHJ1bm5pbmd3ZWVr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4GCQAAAAAAAAIFAAAADkZhdm91cml0ZUFzc2V0AgAAAAVXQVZFUwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAADFZvdGVkX0Fzc2V0XwUAAAAKY3VycmVudEtleQUAAAAORmF2b3VyaXRlQXNzZXQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAHbWVzc2FnZQIAAAAkPGgxPllvdSBWb3RlZCBTdWNjZXNzZnVsbHkhPC9oMT48YnI+CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABNDdXJyZW50X1ZvdGluZ19XZWVrBQAAABJjdXJyZW50cnVubmluZ3dlZWsJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAAORmF2b3VyaXRlQXNzZXQCAAAADF9Ub3RhbF9Wb3RlcwUAAAAKdG90YWx2b3RlcwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAACkE0QUFzc2V0SUQFAAAAA25pbAkAAAIAAAABAgAAABdXcm9uZyBJbnB1dCBGb3IgVm90aW5nLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5fmvDWA==",
"height": 1713103,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 5LRbxejeXXFFcCt7g4v1k3DRze6ix2zduVyqnCPuHXjb
Next: 9unhYDnDCEbL1HYsnmeJFFue3PzqXBYqDregSpbLJeXS
Diff:
Old | New | | Differences |
---|
15 | 15 | | let eachweek = 10080 |
---|
16 | 16 | | let currentrunningweek = ((height - Week0Height) / eachweek) |
---|
17 | 17 | | let checkassetbal = assetBalance(addressFromPublicKey(i.callerPublicKey), A4AAssetID) |
---|
| 18 | + | let fetchvotes = getIntegerValue(this, (FavouriteAsset + "_Total_Votes")) |
---|
| 19 | + | let totalvotes = (fetchvotes + 1) |
---|
18 | 20 | | if ((100000000 > checkassetbal)) |
---|
19 | 21 | | then throw("Minimum 1 A4A is required on Your Address to Vote. Please Mint or hold minimum 1 A4A on this Address.") |
---|
20 | 22 | | else if ((pmt.assetId != A4AAssetID)) |
---|
|
28 | 30 | | else (FavouriteAsset == "TN")) |
---|
29 | 31 | | then true |
---|
30 | 32 | | else (FavouriteAsset == "WAVES")) |
---|
31 | | - | then [StringEntry("Voted_Asset", FavouriteAsset), StringEntry("message", "<h1>You Voted Successfully!</h1><br>"), IntegerEntry("Current_Voting_Week", currentrunningweek), ScriptTransfer(i.caller, 1, A4AAssetID)] |
---|
32 | | - | else throw("Input Error") |
---|
| 33 | + | then [StringEntry(("Voted_Asset_" + currentKey), FavouriteAsset), StringEntry("message", "<h1>You Voted Successfully!</h1><br>"), IntegerEntry("Current_Voting_Week", currentrunningweek), IntegerEntry((FavouriteAsset + "_Total_Votes"), totalvotes), ScriptTransfer(i.caller, 1, A4AAssetID)] |
---|
| 34 | + | else throw("Wrong Input For Voting.") |
---|
33 | 35 | | } |
---|
34 | 36 | | |
---|
35 | 37 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let A4AAssetID = base58'J9VzWPfRSQyCbEv5oWpxLSihigbpbJsGBHJZV9Ct8ook' |
---|
5 | 5 | | |
---|
6 | 6 | | let USDTAssetID = base58'Zn3cLHW7aAVPm5aACcTjvg7e7iEy2cKDtbowok5qa9H' |
---|
7 | 7 | | |
---|
8 | 8 | | @Callable(i) |
---|
9 | 9 | | func Vote (FavouriteAsset) = { |
---|
10 | 10 | | let pmt = if ((size(i.payments) == 1)) |
---|
11 | 11 | | then i.payments[0] |
---|
12 | 12 | | else throw("0.0001 A4A Token is required as Attached payment[1].") |
---|
13 | 13 | | let currentKey = toBase58String(i.caller.bytes) |
---|
14 | 14 | | let Week0Height = 1700850 |
---|
15 | 15 | | let eachweek = 10080 |
---|
16 | 16 | | let currentrunningweek = ((height - Week0Height) / eachweek) |
---|
17 | 17 | | let checkassetbal = assetBalance(addressFromPublicKey(i.callerPublicKey), A4AAssetID) |
---|
| 18 | + | let fetchvotes = getIntegerValue(this, (FavouriteAsset + "_Total_Votes")) |
---|
| 19 | + | let totalvotes = (fetchvotes + 1) |
---|
18 | 20 | | if ((100000000 > checkassetbal)) |
---|
19 | 21 | | then throw("Minimum 1 A4A is required on Your Address to Vote. Please Mint or hold minimum 1 A4A on this Address.") |
---|
20 | 22 | | else if ((pmt.assetId != A4AAssetID)) |
---|
21 | 23 | | then throw((("Incorrect asset attached, please attach " + toBase58String(A4AAssetID)) + " AssetID Only.")) |
---|
22 | 24 | | else if ((10000 > pmt.amount)) |
---|
23 | 25 | | then throw("Please Attach minimum 0.0001 A4A To Vote.") |
---|
24 | 26 | | else if (if (if (if ((FavouriteAsset == "A4A")) |
---|
25 | 27 | | then true |
---|
26 | 28 | | else (FavouriteAsset == "ARRR")) |
---|
27 | 29 | | then true |
---|
28 | 30 | | else (FavouriteAsset == "TN")) |
---|
29 | 31 | | then true |
---|
30 | 32 | | else (FavouriteAsset == "WAVES")) |
---|
31 | | - | then [StringEntry("Voted_Asset", FavouriteAsset), StringEntry("message", "<h1>You Voted Successfully!</h1><br>"), IntegerEntry("Current_Voting_Week", currentrunningweek), ScriptTransfer(i.caller, 1, A4AAssetID)] |
---|
32 | | - | else throw("Input Error") |
---|
| 33 | + | then [StringEntry(("Voted_Asset_" + currentKey), FavouriteAsset), StringEntry("message", "<h1>You Voted Successfully!</h1><br>"), IntegerEntry("Current_Voting_Week", currentrunningweek), IntegerEntry((FavouriteAsset + "_Total_Votes"), totalvotes), ScriptTransfer(i.caller, 1, A4AAssetID)] |
---|
| 34 | + | else throw("Wrong Input For Voting.") |
---|
33 | 35 | | } |
---|
34 | 36 | | |
---|
35 | 37 | | |
---|
36 | 38 | | @Verifier(tx) |
---|
37 | 39 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
38 | 40 | | |
---|