tx · yWHuxyuDpJdVbQfqZGqJMwh82NHb3bok1vPCchHwjkE 3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct: -0.01990000 Waves 2020.10.18 15:56 [1226053] smart account 3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct > SELF 0.00000000 Waves
{ "type": 13, "id": "yWHuxyuDpJdVbQfqZGqJMwh82NHb3bok1vPCchHwjkE", "fee": 1990000, "feeAssetId": null, "timestamp": 1603025776253, "version": 2, "chainId": 84, "sender": "3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct", "senderPublicKey": "2Zu93Nn4XQDQJh61td98RYfNB44AtMrZeguWMuNBS41n", "proofs": [ "49TGHaR35kKfHCBXfJP1YrwpuGnw25bpEcx8Jjf2PKmkfXgr8FKM647uyv7NRjiAyVv1r2P31N3wQHf5jLzn4J5P" ], "script": "base64:AAIDAAAAAAAAAA8IARIAEgASABIDCgEBEgAAAAAAAAAABQAAAAFpAQAAAAhwYXlZaWVsZAAAAAAEAAAAC0dvdmVyblRva2VuAQAAACC8BnLNTH75zY/85pKTg3cOi9DRRgrZqRPS5vvLPGg8zQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAANY3VycmVudEFtb3VudAAAAAAAAAAAAAQAAAARR292ZXJuVG9rZW5BbW91bnQJAAPrAAAAAgUAAAAEdGhpcwUAAAALR292ZXJuVG9rZW4DCQAAZgAAAAIAAAAAAAAAAAEFAAAAEUdvdmVyblRva2VuQW1vdW50CQAAAgAAAAECAAAAIU5vIGVub3VnaCBHb3Zlcm5Ub2tlbiBJbiBDb250cmFjdAk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sZXIAAAAAAAAAAGQFAAAAC0dvdmVyblRva2VuBQAAAANuaWwJAAACAAAAAQIAAABHWW91IG5lZWQgdG8gaGF2ZSBTVGFrZWQgYW5kIEdvdmVyblRva2VuIGluIHRoZSBDb250cmFjdCB0byBjbGFpbSByZXdhcmQAAAAAxwA3XQ==", "height": 1226053, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: JC1Cd3gBP9J6Kvmwv87STa5UVCGC2wASNL5TQ2rN2iNA Next: 9JWc5bPYti7fVHKssj7EFgpDHLxJWJ3ZoSHXHK6uwz5R Diff:
Old | New | Differences | |
---|---|---|---|
134 | 134 | } | |
135 | 135 | if ((PrizeAmount == 0)) | |
136 | 136 | then throw("No prize to Claim") | |
137 | - | else if (( | |
138 | - | then throw(((("You are not the winner hence cannot claim the reward" + UserGovernTokenKey) + " --> ") + winnerPrize)) | |
137 | + | else if ((UserStakedToken != winnerPrize)) | |
138 | + | then throw(((("You are not the winner hence cannot claim the reward " + UserGovernTokenKey) + " --> ") + winnerPrize)) | |
139 | 139 | else if (if ((UserGovernTokenAmount > 100)) | |
140 | 140 | then (UserStakedTokenAmount > 0) | |
141 | 141 | else false) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func payYield () = { | |
8 | 8 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
9 | 9 | let currentKey = toBase58String(i.caller.bytes) | |
10 | 10 | let currentAmount = match getInteger(this, currentKey) { | |
11 | 11 | case a: Int => | |
12 | 12 | a | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | if ((currentAmount > 0)) | |
17 | 17 | then { | |
18 | 18 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
19 | 19 | if ((1 > GovernTokenAmount)) | |
20 | 20 | then throw("No enough GovernToken In Contract") | |
21 | 21 | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)])) | |
22 | 22 | } | |
23 | 23 | else throw("You need to deposit Collateral Token to receive Govern Token") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func Stake () = { | |
30 | 30 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
31 | 31 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
32 | 32 | let pmt = extract(i.payment) | |
33 | 33 | if (if (isDefined(pmt.assetId)) | |
34 | 34 | then (extract(pmt.assetId) == CollateralToken) | |
35 | 35 | else false) | |
36 | 36 | then { | |
37 | 37 | let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(CollateralToken)) | |
38 | 38 | let currentAmount = match getInteger(this, currentKey) { | |
39 | 39 | case a: Int => | |
40 | 40 | a | |
41 | 41 | case _ => | |
42 | 42 | 0 | |
43 | 43 | } | |
44 | 44 | let newAmount = (currentAmount + pmt.amount) | |
45 | 45 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
46 | 46 | if ((1 > GovernTokenAmount)) | |
47 | 47 | then throw("No enough GovernToken In Contract") | |
48 | 48 | else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) | |
49 | 49 | } | |
50 | 50 | else throw("Can deposit only MyToken") | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func PayToken () = { | |
57 | 57 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
58 | 58 | let pmt = extract(i.payment) | |
59 | 59 | if (if (isDefined(pmt.assetId)) | |
60 | 60 | then (extract(pmt.assetId) == GovernToken) | |
61 | 61 | else false) | |
62 | 62 | then { | |
63 | 63 | let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken)) | |
64 | 64 | let currentAmount = match getInteger(this, currentKey) { | |
65 | 65 | case a: Int => | |
66 | 66 | a | |
67 | 67 | case _ => | |
68 | 68 | 0 | |
69 | 69 | } | |
70 | 70 | let newAmount = (currentAmount + pmt.amount) | |
71 | 71 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
72 | 72 | WriteSet([DataEntry(currentKey, newAmount)]) | |
73 | 73 | } | |
74 | 74 | else throw("Can deposit only Govern Token") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||
79 | 79 | @Callable(i) | |
80 | 80 | func withdrawFunds (amount) = { | |
81 | 81 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
82 | 82 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
83 | 83 | let currentKey = toBase58String(i.caller.bytes) | |
84 | 84 | let currentAmount = match getInteger(this, currentKey) { | |
85 | 85 | case a: Int => | |
86 | 86 | a | |
87 | 87 | case _ => | |
88 | 88 | 0 | |
89 | 89 | } | |
90 | 90 | let newAmount = (currentAmount - amount) | |
91 | 91 | if ((0 > amount)) | |
92 | 92 | then throw("Can't withdraw negative amount") | |
93 | 93 | else if ((0 > newAmount)) | |
94 | 94 | then throw("User cannot withdraw more than deposited funds") | |
95 | 95 | else { | |
96 | 96 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
97 | 97 | if ((1 > GovernTokenAmount)) | |
98 | 98 | then throw("No enough GovernToken In Contract") | |
99 | 99 | else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)])) | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | 105 | @Callable(i) | |
106 | 106 | func ClaimPrize () = { | |
107 | 107 | let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
108 | 108 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
109 | 109 | let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD' | |
110 | 110 | let winnerPrize = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(StakedToken)) | |
111 | 111 | let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
112 | 112 | let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
113 | 113 | let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" | |
114 | 114 | let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken)) | |
115 | 115 | let UserStakedToken = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken)) | |
116 | 116 | let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken)) | |
117 | 117 | let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) { | |
118 | 118 | case a: Int => | |
119 | 119 | a | |
120 | 120 | case _ => | |
121 | 121 | 0 | |
122 | 122 | } | |
123 | 123 | let UserStakedTokenAmount = match getInteger(this, UserStakedToken) { | |
124 | 124 | case a: Int => | |
125 | 125 | a | |
126 | 126 | case _ => | |
127 | 127 | 0 | |
128 | 128 | } | |
129 | 129 | let PrizeAmount = match getInteger(this, FundBoxStakedToken) { | |
130 | 130 | case a: Int => | |
131 | 131 | a | |
132 | 132 | case _ => | |
133 | 133 | 0 | |
134 | 134 | } | |
135 | 135 | if ((PrizeAmount == 0)) | |
136 | 136 | then throw("No prize to Claim") | |
137 | - | else if (( | |
138 | - | then throw(((("You are not the winner hence cannot claim the reward" + UserGovernTokenKey) + " --> ") + winnerPrize)) | |
137 | + | else if ((UserStakedToken != winnerPrize)) | |
138 | + | then throw(((("You are not the winner hence cannot claim the reward " + UserGovernTokenKey) + " --> ") + winnerPrize)) | |
139 | 139 | else if (if ((UserGovernTokenAmount > 100)) | |
140 | 140 | then (UserStakedTokenAmount > 0) | |
141 | 141 | else false) | |
142 | 142 | then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)])) | |
143 | 143 | else throw("You need to have STaked and GovernToken in the Contract to claim reward") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 |
github/deemru/w8io/169f3d6 42.98 ms ◑