tx · 2dr36NNg3enjc7r9dj1x4jH3pFVR6Q7HpWnnCFKUnBPE
3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH: -0.09990000 Waves
2020.10.17 20:50 [1224890] smart account 3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH > SELF 0.00000000 Waves
{
"type": 13,
"id": "2dr36NNg3enjc7r9dj1x4jH3pFVR6Q7HpWnnCFKUnBPE",
"fee": 9990000,
"feeAssetId": null,
"timestamp": 1602957025247,
"version": 2,
"chainId": 84,
"sender": "3N3en9HRhzbk3DDqeGd6DUKc1SG4rmpXguH",
"senderPublicKey": "3UC2eCnSLx9fHcXvssZJZLNzMshb9NM6GchfmEhx6syQ",
"proofs": [
"3hsdN1Eg9HUbsVdhpewT4S47VZwzRAdKR35KKMMNbw9USkNyCXtxUs7UAGM3HuuM9NxigBXh8agPy4cNBHS8Q6fF"
],
"script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAAAAAAAAQAAAABaQEAAAAIcGF5WWllbGQAAAAABAAAAAtHb3Zlcm5Ub2tlbgEAAAAgvAZyzUx++c2P/OaSk4N3DovQ0UYK2akT0ub7yzxoPM0EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAADWN1cnJlbnRBbW91bnQAAAAAAAAAAAAEAAAAEUdvdmVyblRva2VuQW1vdW50CQAD6wAAAAIFAAAABHRoaXMFAAAAC0dvdmVyblRva2VuAwkAAGYAAAACAAAAAAAAAAABBQAAABFHb3Zlcm5Ub2tlbkFtb3VudAkAAAIAAAABAgAAACFObyBlbm91Z2ggR292ZXJuVG9rZ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c2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAALUHJpemVBbW91bnQFAAAAD0NvbGxhdGVyYWxUb2tlbgUAAAADbmlsCQAAAgAAAAECAAAAOFlvdSBuZWVkIHRvIGhhdmUgZGVwb3NpdCBpbiB0aGUgQ29udHJhY3QgdG8gY2xhaW0gcmV3YXJkAAAAAGMT32Q=",
"height": 1224890,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4ka5QdGkXJbnFjgSEn47uUq7eegRDrVwJmFQAfyf6R6g
Next: DogKWkJZ2U9s7rrUKWLvtdwWRygno1fbtD1BmHA1Nf3K
Diff:
Old | New | | Differences |
---|
31 | 31 | | @Callable(a) |
---|
32 | 32 | | func deposit () = { |
---|
33 | 33 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 34 | + | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
34 | 35 | | let i = extract(a.payment) |
---|
35 | 36 | | if (if (isDefined(i.assetId)) |
---|
36 | 37 | | then (extract(i.assetId) == h) |
---|
|
47 | 48 | | else 0 |
---|
48 | 49 | | } |
---|
49 | 50 | | let j = (d + i.amount) |
---|
50 | | - | WriteSet([DataEntry(c, j)]) |
---|
| 51 | + | let g = assetBalance(this, b) |
---|
| 52 | + | if ((1 > g)) |
---|
| 53 | + | then throw("No enough GovernToken In Contract") |
---|
| 54 | + | else ScriptResult(WriteSet([DataEntry(c, 10), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 10, b)])) |
---|
51 | 55 | | } |
---|
52 | 56 | | else throw("Can deposit only MyToken") |
---|
53 | 57 | | } |
---|
|
55 | 59 | | |
---|
56 | 60 | | |
---|
57 | 61 | | @Callable(a) |
---|
58 | | - | func withdrawFunds (g) = { |
---|
| 62 | + | func withdrawFunds (k) = { |
---|
59 | 63 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 64 | + | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
60 | 65 | | let c = toBase58String(a.caller.bytes) |
---|
61 | 66 | | let d = { |
---|
62 | 67 | | let e = getInteger(this, c) |
---|
|
67 | 72 | | } |
---|
68 | 73 | | else 0 |
---|
69 | 74 | | } |
---|
70 | | - | let j = (d - g) |
---|
71 | | - | if ((0 > g)) |
---|
| 75 | + | let j = (d - k) |
---|
| 76 | + | if ((0 > k)) |
---|
72 | 77 | | then throw("Can't withdraw negative amount") |
---|
73 | 78 | | else if ((0 > j)) |
---|
74 | 79 | | then throw("User cannot withdraw more than deposited funds") |
---|
75 | | - | else ScriptResult(WriteSet([DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, g, h)])) |
---|
| 80 | + | else { |
---|
| 81 | + | let g = assetBalance(this, b) |
---|
| 82 | + | if ((1 > g)) |
---|
| 83 | + | then throw("No enough GovernToken In Contract") |
---|
| 84 | + | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, k, h)])) |
---|
| 85 | + | } |
---|
76 | 86 | | } |
---|
77 | 87 | | |
---|
78 | 88 | | |
---|
|
80 | 90 | | @Callable(a) |
---|
81 | 91 | | func ClaimPrize () = { |
---|
82 | 92 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
83 | | - | let k = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
84 | | - | let l = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" |
---|
| 93 | + | let l = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
| 94 | + | let m = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" |
---|
85 | 95 | | let c = toBase58String(a.caller.bytes) |
---|
86 | | - | let m = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
87 | | - | let n = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') |
---|
88 | | - | let o = { |
---|
| 96 | + | let n = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
| 97 | + | let o = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') |
---|
| 98 | + | let p = { |
---|
89 | 99 | | let e = getInteger(this, c) |
---|
90 | 100 | | if ($isInstanceOf(e, "Int")) |
---|
91 | 101 | | then { |
---|
|
94 | 104 | | } |
---|
95 | 105 | | else 0 |
---|
96 | 106 | | } |
---|
97 | | - | let p = { |
---|
98 | | - | let e = getInteger(this, l) |
---|
| 107 | + | let q = { |
---|
| 108 | + | let e = getInteger(this, m) |
---|
99 | 109 | | if ($isInstanceOf(e, "Int")) |
---|
100 | 110 | | then { |
---|
101 | 111 | | let f = e |
---|
|
103 | 113 | | } |
---|
104 | 114 | | else 0 |
---|
105 | 115 | | } |
---|
106 | | - | if ((p == 0)) |
---|
| 116 | + | if ((q == 0)) |
---|
107 | 117 | | then throw("No prize to Claim") |
---|
108 | | - | else if ((c != k)) |
---|
| 118 | + | else if ((c != l)) |
---|
109 | 119 | | then throw("You are not the winner hence cannot claim the reward") |
---|
110 | | - | else if ((o > 0)) |
---|
111 | | - | then ScriptResult(WriteSet([DataEntry(k, p), DataEntry(l, 0)]), TransferSet([ScriptTransfer(m, p, h)])) |
---|
| 120 | + | else if ((p > 0)) |
---|
| 121 | + | then ScriptResult(WriteSet([DataEntry(l, q), DataEntry(m, 0)]), TransferSet([ScriptTransfer(n, q, h)])) |
---|
112 | 122 | | else throw("You need to have deposit in the Contract to claim reward") |
---|
113 | 123 | | } |
---|
114 | 124 | | |
---|
Full:
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 deposit () = { |
---|
33 | 33 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 34 | + | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
34 | 35 | | let i = extract(a.payment) |
---|
35 | 36 | | if (if (isDefined(i.assetId)) |
---|
36 | 37 | | then (extract(i.assetId) == h) |
---|
37 | 38 | | else false) |
---|
38 | 39 | | then { |
---|
39 | 40 | | let c = toBase58String(a.caller.bytes) |
---|
40 | 41 | | let d = { |
---|
41 | 42 | | let e = getInteger(this, c) |
---|
42 | 43 | | if ($isInstanceOf(e, "Int")) |
---|
43 | 44 | | then { |
---|
44 | 45 | | let f = e |
---|
45 | 46 | | f |
---|
46 | 47 | | } |
---|
47 | 48 | | else 0 |
---|
48 | 49 | | } |
---|
49 | 50 | | let j = (d + i.amount) |
---|
50 | | - | WriteSet([DataEntry(c, j)]) |
---|
| 51 | + | let g = assetBalance(this, b) |
---|
| 52 | + | if ((1 > g)) |
---|
| 53 | + | then throw("No enough GovernToken In Contract") |
---|
| 54 | + | else ScriptResult(WriteSet([DataEntry(c, 10), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 10, b)])) |
---|
51 | 55 | | } |
---|
52 | 56 | | else throw("Can deposit only MyToken") |
---|
53 | 57 | | } |
---|
54 | 58 | | |
---|
55 | 59 | | |
---|
56 | 60 | | |
---|
57 | 61 | | @Callable(a) |
---|
58 | | - | func withdrawFunds (g) = { |
---|
| 62 | + | func withdrawFunds (k) = { |
---|
59 | 63 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
| 64 | + | let b = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' |
---|
60 | 65 | | let c = toBase58String(a.caller.bytes) |
---|
61 | 66 | | let d = { |
---|
62 | 67 | | let e = getInteger(this, c) |
---|
63 | 68 | | if ($isInstanceOf(e, "Int")) |
---|
64 | 69 | | then { |
---|
65 | 70 | | let f = e |
---|
66 | 71 | | f |
---|
67 | 72 | | } |
---|
68 | 73 | | else 0 |
---|
69 | 74 | | } |
---|
70 | | - | let j = (d - g) |
---|
71 | | - | if ((0 > g)) |
---|
| 75 | + | let j = (d - k) |
---|
| 76 | + | if ((0 > k)) |
---|
72 | 77 | | then throw("Can't withdraw negative amount") |
---|
73 | 78 | | else if ((0 > j)) |
---|
74 | 79 | | then throw("User cannot withdraw more than deposited funds") |
---|
75 | | - | else ScriptResult(WriteSet([DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, g, h)])) |
---|
| 80 | + | else { |
---|
| 81 | + | let g = assetBalance(this, b) |
---|
| 82 | + | if ((1 > g)) |
---|
| 83 | + | then throw("No enough GovernToken In Contract") |
---|
| 84 | + | else ScriptResult(WriteSet([DataEntry(c, 1), DataEntry(c, j)]), TransferSet([ScriptTransfer(a.caller, 1, b), ScriptTransfer(a.caller, k, h)])) |
---|
| 85 | + | } |
---|
76 | 86 | | } |
---|
77 | 87 | | |
---|
78 | 88 | | |
---|
79 | 89 | | |
---|
80 | 90 | | @Callable(a) |
---|
81 | 91 | | func ClaimPrize () = { |
---|
82 | 92 | | let h = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' |
---|
83 | | - | let k = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
84 | | - | let l = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" |
---|
| 93 | + | let l = "3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" |
---|
| 94 | + | let m = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD" |
---|
85 | 95 | | let c = toBase58String(a.caller.bytes) |
---|
86 | | - | let m = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
87 | | - | let n = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') |
---|
88 | | - | let o = { |
---|
| 96 | + | let n = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA') |
---|
| 97 | + | let o = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD') |
---|
| 98 | + | let p = { |
---|
89 | 99 | | let e = getInteger(this, c) |
---|
90 | 100 | | if ($isInstanceOf(e, "Int")) |
---|
91 | 101 | | then { |
---|
92 | 102 | | let f = e |
---|
93 | 103 | | f |
---|
94 | 104 | | } |
---|
95 | 105 | | else 0 |
---|
96 | 106 | | } |
---|
97 | | - | let p = { |
---|
98 | | - | let e = getInteger(this, l) |
---|
| 107 | + | let q = { |
---|
| 108 | + | let e = getInteger(this, m) |
---|
99 | 109 | | if ($isInstanceOf(e, "Int")) |
---|
100 | 110 | | then { |
---|
101 | 111 | | let f = e |
---|
102 | 112 | | f |
---|
103 | 113 | | } |
---|
104 | 114 | | else 0 |
---|
105 | 115 | | } |
---|
106 | | - | if ((p == 0)) |
---|
| 116 | + | if ((q == 0)) |
---|
107 | 117 | | then throw("No prize to Claim") |
---|
108 | | - | else if ((c != k)) |
---|
| 118 | + | else if ((c != l)) |
---|
109 | 119 | | then throw("You are not the winner hence cannot claim the reward") |
---|
110 | | - | else if ((o > 0)) |
---|
111 | | - | then ScriptResult(WriteSet([DataEntry(k, p), DataEntry(l, 0)]), TransferSet([ScriptTransfer(m, p, h)])) |
---|
| 120 | + | else if ((p > 0)) |
---|
| 121 | + | then ScriptResult(WriteSet([DataEntry(l, q), DataEntry(m, 0)]), TransferSet([ScriptTransfer(n, q, h)])) |
---|
112 | 122 | | else throw("You need to have deposit in the Contract to claim reward") |
---|
113 | 123 | | } |
---|
114 | 124 | | |
---|
115 | 125 | | |
---|