tx · C5P19qGN9fzE7n3DnAbjjWstRTf6oSYhCNdcM1WCZN7m 3Mrnje6z2xa3xuXyU2Lk6ynKy8tsRnnt4Bv: -0.01400000 Waves 2021.08.12 11:52 [1654947] smart account 3Mrnje6z2xa3xuXyU2Lk6ynKy8tsRnnt4Bv > SELF 0.00000000 Waves
{ "type": 13, "id": "C5P19qGN9fzE7n3DnAbjjWstRTf6oSYhCNdcM1WCZN7m", "fee": 1400000, "feeAssetId": null, "timestamp": 1628758346850, "version": 2, "chainId": 84, "sender": "3Mrnje6z2xa3xuXyU2Lk6ynKy8tsRnnt4Bv", "senderPublicKey": "28sGn7FYnmxceAmnGYiDiKuMK1QyXiqX8zQXfKDnrc8t", "proofs": [ "57sAr4urZiyADTSoA6xTdWeAVd9Kk7ddQFrCccjWcpxHKcsELo3AS4qxNQBYNscGZMk4DAqRzWNMXr3xAx9DrFuR" ], "script": "base64:AAIEAAAAAAAAAAwIAhIECgIIARIAEgAAAAAAAAAAAwAAAAFpAQAAABVSZWdpc3RlclBhaXJGb3JWb3RpbmcAAAACAAAACEFzc2V0SUQxAAAABGRheXMEAAAABHBtdDEJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAABHBtdDIJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEEAAAAEW1heGltdW12b3RpbmdkYXlzAAAAAAAAAABaBAAAAA1CYWxsZXRBc3NldElEAQAAACAtb1sBuZ3lSm8ahGink+4TF5YYAu/xRHYwe1h195OooAQAAAALVVNEVEFzc2V0SUQBAAAAIF9XaRjICieBJvFbl+3E7E35wrtZyxIYi4RgoF+m9/zzBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAAAlROCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCAUAAAAEcG10MgAAAAd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ZWRCYWxsZXQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAADUJhbGxldEFzc2V0SUQJAAACAAAAAQIAAABKS2luZGx5IERlcG9zaXQgT25seSA0NE1xOEtxVWhNOTR0OTNNaUJxM1MyMmlpdUdjek14cEttc2U1ZEJ5Mnc1eSAoQmFsbGV0KS4DCQAAZgAAAAIAAAAAAAABhqAIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAAMEF0dGFjaCBBbW91bnQgbXVzdCBiZSBncmVhdGVyIHRoYW4gMC4wMDEgQmFsbGV0LgkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAADUJhbGxldEFzc2V0SUQIBQAAAANwbXQAAAAGYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABRUb3RhbF9Jc3N1ZWRfQmFsbGV0OgUAAAARVG90YWxJc3N1ZWRCYWxsZXQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAAG1RvdGFsX0JhbGxldF9SZXNlcnZlX0luX1ROOgUAAAASQmFsbGV0UmVzZXJ2ZVZhbHVlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAABpCYWxsZXRfQmFja3VwX1ZhbHVlX0luX1ROOgUAAAARQmFsbGV0QmFja3VwUHJpY2UJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAABJjYWxjdWxhdGVidXJudmFsdWUFAAAABHVuaXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4CQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleUFnUhA=", "height": 1654947, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2axr1n6FiMcLjRCi6QWxnFC2tAunVKdX3Ye6C23oTVid Next: BJR2NFBoSjB4jf4Qp8BAZyjyvDbKH9tWP1fnKYm5jxJz Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func checkVotingPair (AssetID1) = match getString(this, AssetID1) { | |
5 | - | case a: String => | |
6 | - | a | |
7 | - | case _ => | |
8 | - | "NONE" | |
9 | - | } | |
10 | 4 | ||
11 | 5 | ||
12 | 6 | @Callable(i) | |
19 | 13 | let currentKey = toBase58String(i.caller.bytes) | |
20 | 14 | let TN = !(isDefined(pmt2.assetId)) | |
21 | 15 | let oneday = 1440 | |
22 | - | let NoOfDaysBlocks = (1440 * days) | |
16 | + | let NoOfDaysBlocks = (oneday * days) | |
17 | + | let gap = (NoOfDaysBlocks - 43199) | |
18 | + | let votesrequired = (100000 + (fraction(11574, 1, 10000) * gap)) | |
23 | 19 | let votingExpire = (height + NoOfDaysBlocks) | |
24 | 20 | let fetchpair = getString(this, ("Pair_Under_Voting_" + AssetID1)) | |
25 | 21 | if ((44 > size(AssetID1))) | |
26 | 22 | then throw("Wrong AssetID1 is Entered for Voting. Please Enter a Valid AssetID1. Probably you entered an ASSETID1 less than 44 Chars.") | |
27 | - | else if (( | |
28 | - | then throw("Enter no. of days in between | |
23 | + | else if ((29 >= days)) | |
24 | + | then throw("Enter no. of days in between 30 to 90.") | |
29 | 25 | else if ((days > maximumvotingdays)) | |
30 | 26 | then throw("You Entered days greater than 90 please Enter no. of days in between 1 to 90.") | |
31 | 27 | else if ((fetchpair == AssetID1)) | |
40 | 36 | then throw("You Attached TN Asset ID for Voting, please attach the Token You want to list in payment[2].") | |
41 | 37 | else if ((pmt2.assetId == BalletAssetID)) | |
42 | 38 | then throw("You Attached Ballet asset for Voting in both payments, please attach the Token You want to list in payment[2].") | |
43 | - | else [StringEntry(("Pair_Under_Voting_" + AssetID1), AssetID1), IntegerEntry(("Voting_Start_Height_" + AssetID1), height), IntegerEntry(("Voting_End_Height_" + AssetID1), votingExpire), IntegerEntry(("Voting_Period_" + AssetID1), NoOfDaysBlocks), IntegerEntry(("Voting_Listing_Fee_" + AssetID1), pmt1.amount)] | |
39 | + | else [StringEntry(("Pair_Under_Voting_" + AssetID1), AssetID1), IntegerEntry(("Voting_Start_Height_" + AssetID1), height), IntegerEntry(("Voting_End_Height_" + AssetID1), votingExpire), IntegerEntry(("Voting_Period_" + AssetID1), NoOfDaysBlocks), IntegerEntry(("Voting_Listing_Fee_" + AssetID1), pmt1.amount), IntegerEntry(("Votes_Required_" + AssetID1), pmt1.amount)] | |
44 | 40 | } | |
45 | 41 | ||
46 | 42 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func checkVotingPair (AssetID1) = match getString(this, AssetID1) { | |
5 | - | case a: String => | |
6 | - | a | |
7 | - | case _ => | |
8 | - | "NONE" | |
9 | - | } | |
10 | 4 | ||
11 | 5 | ||
12 | 6 | @Callable(i) | |
13 | 7 | func RegisterPairForVoting (AssetID1,days) = { | |
14 | 8 | let pmt1 = value(i.payments[0]) | |
15 | 9 | let pmt2 = value(i.payments[1]) | |
16 | 10 | let maximumvotingdays = 90 | |
17 | 11 | let BalletAssetID = base58'44Mq8KqUhM94t93MiBq3S22iiuGczMxpKmse5dBy2w5y' | |
18 | 12 | let USDTAssetID = base58'7RB3BWayeCVPq3kkpkeJZAFv2DYCB5gEwnutEpRofaw4' | |
19 | 13 | let currentKey = toBase58String(i.caller.bytes) | |
20 | 14 | let TN = !(isDefined(pmt2.assetId)) | |
21 | 15 | let oneday = 1440 | |
22 | - | let NoOfDaysBlocks = (1440 * days) | |
16 | + | let NoOfDaysBlocks = (oneday * days) | |
17 | + | let gap = (NoOfDaysBlocks - 43199) | |
18 | + | let votesrequired = (100000 + (fraction(11574, 1, 10000) * gap)) | |
23 | 19 | let votingExpire = (height + NoOfDaysBlocks) | |
24 | 20 | let fetchpair = getString(this, ("Pair_Under_Voting_" + AssetID1)) | |
25 | 21 | if ((44 > size(AssetID1))) | |
26 | 22 | then throw("Wrong AssetID1 is Entered for Voting. Please Enter a Valid AssetID1. Probably you entered an ASSETID1 less than 44 Chars.") | |
27 | - | else if (( | |
28 | - | then throw("Enter no. of days in between | |
23 | + | else if ((29 >= days)) | |
24 | + | then throw("Enter no. of days in between 30 to 90.") | |
29 | 25 | else if ((days > maximumvotingdays)) | |
30 | 26 | then throw("You Entered days greater than 90 please Enter no. of days in between 1 to 90.") | |
31 | 27 | else if ((fetchpair == AssetID1)) | |
32 | 28 | then throw("Pair Already Exist in Voting List.") | |
33 | 29 | else if ((size(i.payments) != 2)) | |
34 | 30 | then throw("Two attached assets expected as payment. Kindly Attach payment1 = Ballet Token and payment2 = Token You want to add to List for Voting.") | |
35 | 31 | else if ((pmt1.assetId != BalletAssetID)) | |
36 | 32 | then throw("Incorrect asset attached for Voting in payment[1], please attach 1000 Ballet Token only.") | |
37 | 33 | else if ((40000000 > pmt1.amount)) | |
38 | 34 | then throw((((("You attached only " + toString(fraction(pmt1.amount, 1, 100000000))) + ".") + toString(fraction(pmt1.amount, 1, 10000000))) + " Ballet for Voting in payment[1], please attach 1000 Ballet Token only.")) | |
39 | 35 | else if ((TN == true)) | |
40 | 36 | then throw("You Attached TN Asset ID for Voting, please attach the Token You want to list in payment[2].") | |
41 | 37 | else if ((pmt2.assetId == BalletAssetID)) | |
42 | 38 | then throw("You Attached Ballet asset for Voting in both payments, please attach the Token You want to list in payment[2].") | |
43 | - | else [StringEntry(("Pair_Under_Voting_" + AssetID1), AssetID1), IntegerEntry(("Voting_Start_Height_" + AssetID1), height), IntegerEntry(("Voting_End_Height_" + AssetID1), votingExpire), IntegerEntry(("Voting_Period_" + AssetID1), NoOfDaysBlocks), IntegerEntry(("Voting_Listing_Fee_" + AssetID1), pmt1.amount)] | |
39 | + | else [StringEntry(("Pair_Under_Voting_" + AssetID1), AssetID1), IntegerEntry(("Voting_Start_Height_" + AssetID1), height), IntegerEntry(("Voting_End_Height_" + AssetID1), votingExpire), IntegerEntry(("Voting_Period_" + AssetID1), NoOfDaysBlocks), IntegerEntry(("Voting_Listing_Fee_" + AssetID1), pmt1.amount), IntegerEntry(("Votes_Required_" + AssetID1), pmt1.amount)] | |
44 | 40 | } | |
45 | 41 | ||
46 | 42 | ||
47 | 43 | ||
48 | 44 | @Callable(i) | |
49 | 45 | func IssueBallet () = { | |
50 | 46 | let pmt = value(i.payments[0]) | |
51 | 47 | let currentKey = toBase58String(i.caller.bytes) | |
52 | 48 | let BalletAssetID = base58'44Mq8KqUhM94t93MiBq3S22iiuGczMxpKmse5dBy2w5y' | |
53 | 49 | let PricePerBallet = getIntegerValue(this, "BALLET/TN") | |
54 | 50 | let NewBalletToUser = fraction(100000, pmt.amount, PricePerBallet) | |
55 | 51 | let PreviousIssuedBallet = getIntegerValue(this, "Total_Issued_Ballet:") | |
56 | 52 | let TotalIssuedBallet = (PreviousIssuedBallet + NewBalletToUser) | |
57 | 53 | let PreviousBalletReserveValue = getIntegerValue(this, "Total_Ballet_Reserve_In_TN:") | |
58 | 54 | let BalletReserveValue = (PreviousBalletReserveValue + pmt.amount) | |
59 | 55 | let PreviousBalletBackupPrice = getIntegerValue(this, "Ballet_Backup_Value_In_TN:") | |
60 | 56 | let BalletBackupPrice = fraction(100000, BalletReserveValue, TotalIssuedBallet) | |
61 | 57 | let FeeAddress = base58'8d4zGuTjT3h67Z4DatzMXdXXW1GvoQhMTjwCGFxJuene' | |
62 | 58 | if (isDefined(pmt.assetId)) | |
63 | 59 | then throw("Incorrect asset attached, please attach TN.") | |
64 | 60 | else if ((5000000 > pmt.amount)) | |
65 | 61 | then throw("Please Attach minimum 0.05 TN To Issue Ballet Asset.") | |
66 | 62 | else [IntegerEntry("Total_Issued_Ballet:", TotalIssuedBallet), IntegerEntry("Total_Ballet_Reserve_In_TN:", BalletReserveValue), IntegerEntry("Ballet_Backup_Value_In_TN:", BalletBackupPrice), StringEntry("message", "<h1>Ballet Issued Successfully!</h1><br>"), Reissue(BalletAssetID, NewBalletToUser, true), ScriptTransfer(i.caller, ((NewBalletToUser * 99) / 100), BalletAssetID), ScriptTransfer(addressFromPublicKey(FeeAddress), ((NewBalletToUser * 1) / 100), BalletAssetID)] | |
67 | 63 | } | |
68 | 64 | ||
69 | 65 | ||
70 | 66 | ||
71 | 67 | @Callable(i) | |
72 | 68 | func Liquidate () = { | |
73 | 69 | let currentKey = toBase58String(i.callerPublicKey) | |
74 | 70 | let pmt = value(i.payments[0]) | |
75 | 71 | let BalletAssetID = base58'44Mq8KqUhM94t93MiBq3S22iiuGczMxpKmse5dBy2w5y' | |
76 | 72 | let PreviousIssuedBallet = getIntegerValue(this, "Total_Issued_Ballet:") | |
77 | 73 | let TotalIssuedBallet = (PreviousIssuedBallet - pmt.amount) | |
78 | 74 | let PreviousBalletReserveValue = getIntegerValue(this, "Total_Ballet_Reserve_In_TN:") | |
79 | 75 | let PreviousBalletBackupPrice = getIntegerValue(this, "Ballet_Backup_Value_In_TN:") | |
80 | 76 | let calculateburnvalue = fraction(PreviousBalletBackupPrice, pmt.amount, 100000) | |
81 | 77 | let BalletReserveValue = (PreviousBalletReserveValue - calculateburnvalue) | |
82 | 78 | let BalletBackupPrice = fraction(100000, BalletReserveValue, TotalIssuedBallet) | |
83 | 79 | if ((pmt.assetId != BalletAssetID)) | |
84 | 80 | then throw("Kindly Deposit Only 44Mq8KqUhM94t93MiBq3S22iiuGczMxpKmse5dBy2w5y (Ballet).") | |
85 | 81 | else if ((100000 > pmt.amount)) | |
86 | 82 | then throw("Attach Amount must be greater than 0.001 Ballet.") | |
87 | 83 | else [Burn(BalletAssetID, pmt.amount), IntegerEntry("Total_Issued_Ballet:", TotalIssuedBallet), IntegerEntry("Total_Ballet_Reserve_In_TN:", BalletReserveValue), IntegerEntry("Ballet_Backup_Value_In_TN:", BalletBackupPrice), ScriptTransfer(i.caller, calculateburnvalue, unit)] | |
88 | 84 | } | |
89 | 85 | ||
90 | 86 | ||
91 | 87 | @Verifier(tx) | |
92 | 88 | func verify () = match tx { | |
93 | 89 | case _ => | |
94 | 90 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
95 | 91 | } | |
96 | 92 |
github/deemru/w8io/169f3d6 46.68 ms ◑