tx · 9bvdqNr3rreeKWQiWhT9sZ3nJERdaUAaPqBF9PrKZsxD 3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct: -0.03099000 Waves 2020.10.18 20:49 [1226336] smart account 3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct > SELF 0.00000000 Waves
{ "type": 13, "id": "9bvdqNr3rreeKWQiWhT9sZ3nJERdaUAaPqBF9PrKZsxD", "fee": 3099000, "feeAssetId": null, "timestamp": 1603043384819, "version": 2, "chainId": 84, "sender": "3N2uKeePNFjWTA1HgzWDRC1DTENWkn1S9ct", "senderPublicKey": "2Zu93Nn4XQDQJh61td98RYfNB44AtMrZeguWMuNBS41n", "proofs": [ "24HD5KTMyFkmgVWsiVi6Hsk9kSy3LB4We9mDVQ92VQuuEoA69UHhnHP5jvvFzk8P9CwMYJBkNUcsVx4KDguNyuwk" ], "script": "base64:AAIDAAAAAAAAAA8IARIAEgASABIDCgEBEgAAAAAAAAAABQAAAAFpAQAAAAhwYXlZaWVsZAAAAAAEAAAAC0dvdmVyblRva2VuAQAAACC8BnLNTH75zY/85pKTg3cOi9DRRgrZqRPS5vvLPGg8zQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAANY3VycmVudEFtb3VudAAAAAAAAAAAAAQAAAARR292ZXJuVG9rZW5BbW91bnQJAAPrAAAAAgUAAAAEdGhpcwUAAAALR292ZXJuVG9rZW4DCQAAZgAAAAIAAAAAAAAAAAEFAAAAEUdvdmVyblRva2VuQW1vdW50CQAAAgAAAAECAAAAIU5vIGVub3VnaCBHb3Zlcm5Ub2tlbiBJbiBD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AAAAAAAAAEFAAAAFVVzZXJTdGFrZWRUb2tlbkFtb3VudAkAAAIAAAABCQABLAAAAAICAAAAUllvdSBoYXZlIHRvIFN0YWtlIFN0YWtlZFRva2VuIHRvIGNsYWltIHJld2FyZCAKIFlvdXIgQmFsYW5jZSBvZiBTdGFrZWQgVG9rZW5zIGlzOiAJAAGkAAAAAQUAAAAVVXNlclN0YWtlZFRva2VuQW1vdW50AwkAAGYAAAACBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAAAAAAAGQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAt3aW5uZXJQcml6ZQUAAAALUHJpemVBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEkZ1bmRCb3hTdGFrZWRUb2tlbgAAAAAAAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVXNlckdvdmVyblRva2VuS2V5AAAAAAAAAABkBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAALUHJpemVBbW91bnQFAAAAC1N0YWtlZFRva2VuCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAZAUAAAALR292ZXJuVG9rZW4FAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAR1lvdSBoYXZlIHRvIGRlcG9zaXQgMTAwIEdvdmVyblRva2VuIHRvIGNsYWltIFJld2FyZCAKIFlvdXIgQmFsYW5jZSBpczogCQABpAAAAAEFAAAAFVVzZXJHb3Zlcm5Ub2tlbkFtb3VudAAAAABNZL4k", "height": 1226336, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9JWc5bPYti7fVHKssj7EFgpDHLxJWJ3ZoSHXHK6uwz5R Next: 8QoFcm59vvwitxgktTLNW6G8nhV2aNB6okdNsr7jSyxH Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | @Callable(a) | |
62 | 62 | func PayToken () = { | |
63 | 63 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
64 | + | let k = toBase58String(b) | |
64 | 65 | let i = extract(a.payment) | |
65 | 66 | if (if (isDefined(i.assetId)) | |
66 | 67 | then (extract(i.assetId) == b) | |
76 | 77 | } | |
77 | 78 | else 0 | |
78 | 79 | } | |
79 | - | let j = (d + i.amount) | |
80 | - | let g = assetBalance(this, b) | |
81 | - | WriteSet([DataEntry(c, j)]) | |
80 | + | let l = (d + i.amount) | |
81 | + | let m = assetBalance(this, b) | |
82 | + | let n = { | |
83 | + | let e = getInteger(Address(b), k) | |
84 | + | if ($isInstanceOf(e, "Int")) | |
85 | + | then { | |
86 | + | let f = e | |
87 | + | f | |
88 | + | } | |
89 | + | else 0 | |
90 | + | } | |
91 | + | if ((l > n)) | |
92 | + | then WriteSet([DataEntry(c, l)]) | |
93 | + | else throw(((("Your Balance of GovernToken is " + toString(l)) + " But Max GovernToken is: ") + toString(n))) | |
82 | 94 | } | |
83 | 95 | else throw("Can deposit only Govern Token") | |
84 | 96 | } | |
86 | 98 | ||
87 | 99 | ||
88 | 100 | @Callable(a) | |
89 | - | func withdrawFunds ( | |
101 | + | func withdrawFunds (o) = { | |
90 | 102 | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
91 | 103 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
92 | 104 | let c = toBase58String(a.caller.bytes) | |
99 | 111 | } | |
100 | 112 | else 0 | |
101 | 113 | } | |
102 | - | let j = (d - | |
103 | - | if ((0 > | |
114 | + | let j = (d - o) | |
115 | + | if ((0 > o)) | |
104 | 116 | then throw("Can't withdraw negative amount") | |
105 | 117 | else if ((0 > j)) | |
106 | 118 | then throw("User cannot withdraw more than deposited funds") | |
108 | 120 | let g = assetBalance(this, b) | |
109 | 121 | if ((1 > g)) | |
110 | 122 | then throw("No enough GovernToken In Contract") | |
111 | - | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, | |
123 | + | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, o, h)])) | |
112 | 124 | } | |
113 | 125 | } | |
114 | 126 | ||
116 | 128 | ||
117 | 129 | @Callable(a) | |
118 | 130 | func ClaimPrize () = { | |
119 | - | let | |
131 | + | let p = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
120 | 132 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
121 | - | let | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | let | |
126 | - | let | |
127 | - | let | |
128 | - | let | |
129 | - | let | |
130 | - | let e = getInteger(this, | |
133 | + | let q = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD' | |
134 | + | let r = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(p)) | |
135 | + | let s = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
136 | + | let t = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
137 | + | let u = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" | |
138 | + | let v = ((toBase58String(a.caller.bytes) + "_") + toBase58String(b)) | |
139 | + | let w = ((toBase58String(a.caller.bytes) + "_") + toBase58String(p)) | |
140 | + | let x = ((toBase58String(q) + "_") + toBase58String(p)) | |
141 | + | let y = { | |
142 | + | let e = getInteger(this, v) | |
131 | 143 | if ($isInstanceOf(e, "Int")) | |
132 | 144 | then { | |
133 | 145 | let f = e | |
135 | 147 | } | |
136 | 148 | else 0 | |
137 | 149 | } | |
138 | - | let | |
139 | - | let e = getInteger(this, | |
150 | + | let z = { | |
151 | + | let e = getInteger(this, w) | |
140 | 152 | if ($isInstanceOf(e, "Int")) | |
141 | 153 | then { | |
142 | 154 | let f = e | |
144 | 156 | } | |
145 | 157 | else 0 | |
146 | 158 | } | |
147 | - | let | |
148 | - | let e = getInteger(this, | |
159 | + | let A = { | |
160 | + | let e = getInteger(this, x) | |
149 | 161 | if ($isInstanceOf(e, "Int")) | |
150 | 162 | then { | |
151 | 163 | let f = e | |
153 | 165 | } | |
154 | 166 | else 0 | |
155 | 167 | } | |
156 | - | if (( | |
168 | + | if ((A == 0)) | |
157 | 169 | then throw("No prize to Claim") | |
158 | - | else if ((s != n)) | |
159 | - | then throw(((("You are not the winner hence cannot claim the reward " + r) + " --> ") + n)) | |
160 | - | else if ((1 > v)) | |
161 | - | then throw("You have to Stake StakedToken to claim reward") | |
162 | - | else if ((u > 100)) | |
163 | - | then ScriptResult(WriteSet([DataEntry(n, w), DataEntry(t, 0), DataEntry(r, 100)]), TransferSet([ScriptTransfer(o, w, l), ScriptTransfer(a.caller, 100, b)])) | |
164 | - | else throw("You have to deposit 100 GovernToken to claim Reward") | |
170 | + | else if ((w != r)) | |
171 | + | then throw("You are not the winner hence cannot claim the reward ") | |
172 | + | else if ((1 > z)) | |
173 | + | then throw(("You have to Stake StakedToken to claim reward | |
174 | + | Your Balance of Staked Tokens is: " + toString(z))) | |
175 | + | else if ((y > 100)) | |
176 | + | then ScriptResult(WriteSet([DataEntry(r, A), DataEntry(x, 0), DataEntry(v, 100)]), TransferSet([ScriptTransfer(s, A, p), ScriptTransfer(a.caller, 100, b)])) | |
177 | + | else throw(("You have to deposit 100 GovernToken to claim Reward | |
178 | + | Your Balance is: " + toString(y))) | |
165 | 179 | } | |
166 | 180 | ||
167 | 181 |
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(a) | |
7 | 7 | func payYield () = { | |
8 | 8 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
9 | 9 | let c = toBase58String(a.caller.bytes) | |
10 | 10 | let d = { | |
11 | 11 | let e = getInteger(this, c) | |
12 | 12 | if ($isInstanceOf(e, "Int")) | |
13 | 13 | then { | |
14 | 14 | let f = e | |
15 | 15 | f | |
16 | 16 | } | |
17 | 17 | else 0 | |
18 | 18 | } | |
19 | 19 | if ((d > 0)) | |
20 | 20 | then { | |
21 | 21 | let g = assetBalance(this, b) | |
22 | 22 | if ((1 > g)) | |
23 | 23 | then throw("No enough GovernToken In Contract") | |
24 | 24 | else ScriptResult(WriteSet([DataEntry(c, 10)]), TransferSet([ScriptTransfer(a.caller, 1, b)])) | |
25 | 25 | } | |
26 | 26 | else throw("You need to deposit Collateral Token to receive Govern Token") | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(a) | |
32 | 32 | func Stake () = { | |
33 | 33 | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
34 | 34 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
35 | 35 | let i = extract(a.payment) | |
36 | 36 | if (if (isDefined(i.assetId)) | |
37 | 37 | then (extract(i.assetId) == h) | |
38 | 38 | else false) | |
39 | 39 | then { | |
40 | 40 | let c = ((toBase58String(a.caller.bytes) + "_") + toBase58String(h)) | |
41 | 41 | let d = { | |
42 | 42 | let e = getInteger(this, c) | |
43 | 43 | if ($isInstanceOf(e, "Int")) | |
44 | 44 | then { | |
45 | 45 | let f = e | |
46 | 46 | f | |
47 | 47 | } | |
48 | 48 | else 0 | |
49 | 49 | } | |
50 | 50 | let j = (d + i.amount) | |
51 | 51 | let g = assetBalance(this, b) | |
52 | 52 | if ((1 > g)) | |
53 | 53 | then throw("No enough GovernToken In Contract") | |
54 | 54 | else ScriptResult(WriteSet([DataEntry(c, 10), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 10, b)])) | |
55 | 55 | } | |
56 | 56 | else throw("Can deposit only MyToken") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | 61 | @Callable(a) | |
62 | 62 | func PayToken () = { | |
63 | 63 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
64 | + | let k = toBase58String(b) | |
64 | 65 | let i = extract(a.payment) | |
65 | 66 | if (if (isDefined(i.assetId)) | |
66 | 67 | then (extract(i.assetId) == b) | |
67 | 68 | else false) | |
68 | 69 | then { | |
69 | 70 | let c = ((toBase58String(a.caller.bytes) + "_") + toBase58String(b)) | |
70 | 71 | let d = { | |
71 | 72 | let e = getInteger(this, c) | |
72 | 73 | if ($isInstanceOf(e, "Int")) | |
73 | 74 | then { | |
74 | 75 | let f = e | |
75 | 76 | f | |
76 | 77 | } | |
77 | 78 | else 0 | |
78 | 79 | } | |
79 | - | let j = (d + i.amount) | |
80 | - | let g = assetBalance(this, b) | |
81 | - | WriteSet([DataEntry(c, j)]) | |
80 | + | let l = (d + i.amount) | |
81 | + | let m = assetBalance(this, b) | |
82 | + | let n = { | |
83 | + | let e = getInteger(Address(b), k) | |
84 | + | if ($isInstanceOf(e, "Int")) | |
85 | + | then { | |
86 | + | let f = e | |
87 | + | f | |
88 | + | } | |
89 | + | else 0 | |
90 | + | } | |
91 | + | if ((l > n)) | |
92 | + | then WriteSet([DataEntry(c, l)]) | |
93 | + | else throw(((("Your Balance of GovernToken is " + toString(l)) + " But Max GovernToken is: ") + toString(n))) | |
82 | 94 | } | |
83 | 95 | else throw("Can deposit only Govern Token") | |
84 | 96 | } | |
85 | 97 | ||
86 | 98 | ||
87 | 99 | ||
88 | 100 | @Callable(a) | |
89 | - | func withdrawFunds ( | |
101 | + | func withdrawFunds (o) = { | |
90 | 102 | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
91 | 103 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
92 | 104 | let c = toBase58String(a.caller.bytes) | |
93 | 105 | let d = { | |
94 | 106 | let e = getInteger(this, c) | |
95 | 107 | if ($isInstanceOf(e, "Int")) | |
96 | 108 | then { | |
97 | 109 | let f = e | |
98 | 110 | f | |
99 | 111 | } | |
100 | 112 | else 0 | |
101 | 113 | } | |
102 | - | let j = (d - | |
103 | - | if ((0 > | |
114 | + | let j = (d - o) | |
115 | + | if ((0 > o)) | |
104 | 116 | then throw("Can't withdraw negative amount") | |
105 | 117 | else if ((0 > j)) | |
106 | 118 | then throw("User cannot withdraw more than deposited funds") | |
107 | 119 | else { | |
108 | 120 | let g = assetBalance(this, b) | |
109 | 121 | if ((1 > g)) | |
110 | 122 | then throw("No enough GovernToken In Contract") | |
111 | - | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, | |
123 | + | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, o, h)])) | |
112 | 124 | } | |
113 | 125 | } | |
114 | 126 | ||
115 | 127 | ||
116 | 128 | ||
117 | 129 | @Callable(a) | |
118 | 130 | func ClaimPrize () = { | |
119 | - | let | |
131 | + | let p = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
120 | 132 | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
121 | - | let | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | let | |
126 | - | let | |
127 | - | let | |
128 | - | let | |
129 | - | let | |
130 | - | let e = getInteger(this, | |
133 | + | let q = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD' | |
134 | + | let r = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(p)) | |
135 | + | let s = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') | |
136 | + | let t = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') | |
137 | + | let u = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" | |
138 | + | let v = ((toBase58String(a.caller.bytes) + "_") + toBase58String(b)) | |
139 | + | let w = ((toBase58String(a.caller.bytes) + "_") + toBase58String(p)) | |
140 | + | let x = ((toBase58String(q) + "_") + toBase58String(p)) | |
141 | + | let y = { | |
142 | + | let e = getInteger(this, v) | |
131 | 143 | if ($isInstanceOf(e, "Int")) | |
132 | 144 | then { | |
133 | 145 | let f = e | |
134 | 146 | f | |
135 | 147 | } | |
136 | 148 | else 0 | |
137 | 149 | } | |
138 | - | let | |
139 | - | let e = getInteger(this, | |
150 | + | let z = { | |
151 | + | let e = getInteger(this, w) | |
140 | 152 | if ($isInstanceOf(e, "Int")) | |
141 | 153 | then { | |
142 | 154 | let f = e | |
143 | 155 | f | |
144 | 156 | } | |
145 | 157 | else 0 | |
146 | 158 | } | |
147 | - | let | |
148 | - | let e = getInteger(this, | |
159 | + | let A = { | |
160 | + | let e = getInteger(this, x) | |
149 | 161 | if ($isInstanceOf(e, "Int")) | |
150 | 162 | then { | |
151 | 163 | let f = e | |
152 | 164 | f | |
153 | 165 | } | |
154 | 166 | else 0 | |
155 | 167 | } | |
156 | - | if (( | |
168 | + | if ((A == 0)) | |
157 | 169 | then throw("No prize to Claim") | |
158 | - | else if ((s != n)) | |
159 | - | then throw(((("You are not the winner hence cannot claim the reward " + r) + " --> ") + n)) | |
160 | - | else if ((1 > v)) | |
161 | - | then throw("You have to Stake StakedToken to claim reward") | |
162 | - | else if ((u > 100)) | |
163 | - | then ScriptResult(WriteSet([DataEntry(n, w), DataEntry(t, 0), DataEntry(r, 100)]), TransferSet([ScriptTransfer(o, w, l), ScriptTransfer(a.caller, 100, b)])) | |
164 | - | else throw("You have to deposit 100 GovernToken to claim Reward") | |
170 | + | else if ((w != r)) | |
171 | + | then throw("You are not the winner hence cannot claim the reward ") | |
172 | + | else if ((1 > z)) | |
173 | + | then throw(("You have to Stake StakedToken to claim reward | |
174 | + | Your Balance of Staked Tokens is: " + toString(z))) | |
175 | + | else if ((y > 100)) | |
176 | + | then ScriptResult(WriteSet([DataEntry(r, A), DataEntry(x, 0), DataEntry(v, 100)]), TransferSet([ScriptTransfer(s, A, p), ScriptTransfer(a.caller, 100, b)])) | |
177 | + | else throw(("You have to deposit 100 GovernToken to claim Reward | |
178 | + | Your Balance is: " + toString(y))) | |
165 | 179 | } | |
166 | 180 | ||
167 | 181 |
github/deemru/w8io/169f3d6 50.31 ms ◑