tx · GSCiShWzB6Mzf1kREHM4bdrG1SxVqp8RkBy3RHqAwYTM 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF: -0.01400000 Waves 2020.03.11 21:48 [904861] smart account 3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF > SELF 0.00000000 Waves
{ "type": 13, "id": "GSCiShWzB6Mzf1kREHM4bdrG1SxVqp8RkBy3RHqAwYTM", "fee": 1400000, "feeAssetId": null, "timestamp": 1583952510174, "version": 1, "sender": "3N5jpkcHiH5R36y9cYnoXhVHe4pxRkS3peF", "senderPublicKey": "9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3", "proofs": [ "m5mbs5q9jM8A1twvq3UF2mVcLmpdhwK6RLEuG6bYbGMvjx6bvc7Wvutfo8H4LwzHt3nF2CBqjWZQy2Zm6tzt6KH" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASABIDCgEBAAAABQAAAAAGRVVDb2luAQAAACDJofoUphCC2vgdQrn0R0tQm4QOreBLRVolNScltI/WUQAAAAAGVVNDb2luAQAAACCWpimiLpI8FZFaHXIW3ZwI74bEgcPecoAv5ODcRcQ7/QAAAAAOb3duZXJQdWJsaWNLZXkBAAAAIIR0OzhzTJc1ozXjp3CfISpQxO2vbrCrTGSiFABFRe8mAAAAAA1PcmFjbGVBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEJAAGbAAAAAQIAAAAjM05BY29lV2RVVFduOGNzWEpQRzQ3djFGanRqY2ZxeGI1dHUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAANT3JhY2xlQWRkcmVzcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAAEAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAW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AAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgeZWYSF", "chainId": 84, "height": 904861, "spentComplexity": 0 } View: original | compacted Prev: 8eAZXqdiowrtgvgRXTPy9oT42cDPR1LfHqg1pD5BHSdB Next: 8sQt1rbCfmgMkaT1YCXhAG72QuAqLKqUbXTVDN2hjgWv Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | } | |
54 | 54 | else 0 | |
55 | 55 | } | |
56 | - | let m = e("waves_usd_2") | |
56 | + | let m = { | |
57 | + | let g = getInteger(d, "waves_usd_2") | |
58 | + | if ($isInstanceOf(g, "Int")) | |
59 | + | then { | |
60 | + | let h = g | |
61 | + | h | |
62 | + | } | |
63 | + | else 0 | |
64 | + | } | |
57 | 65 | let n = j.amount | |
58 | 66 | let o = (l + j.amount) | |
59 | 67 | ScriptResult(WriteSet([DataEntry((k + "_waves"), o)]), TransferSet([ScriptTransfer(i.caller, n, a)])) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'Ea6CdDfumo8ZFecxUSWKAjZpQXmkRC79WB4ktu3KffPn' | |
5 | 5 | ||
6 | 6 | let b = base58'B957NA5BEM8quCDhe1fUPkqBSdCZdJunNxjGE8FRJkWx' | |
7 | 7 | ||
8 | 8 | let c = base58'9v3cUhWaBqFKLuHQTbz2osNsxRANDcpaRZja43mFNkR3' | |
9 | 9 | ||
10 | 10 | let d = Address(toBytes("3NAcoeWdUTWn8csXJPG47v1Fjtjcfqxb5tu")) | |
11 | 11 | ||
12 | 12 | func e (f) = { | |
13 | 13 | let g = getInteger(d, f) | |
14 | 14 | if ($isInstanceOf(g, "Int")) | |
15 | 15 | then { | |
16 | 16 | let h = g | |
17 | 17 | h | |
18 | 18 | } | |
19 | 19 | else 0 | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func deposit () = { | |
25 | 25 | let j = extract(i.payment) | |
26 | 26 | if (isDefined(j.assetId)) | |
27 | 27 | then if ((j.assetId == b)) | |
28 | 28 | then { | |
29 | 29 | let k = toBase58String(i.caller.bytes) | |
30 | 30 | let l = { | |
31 | 31 | let g = getInteger(this, (k + "_uscoin")) | |
32 | 32 | if ($isInstanceOf(g, "Int")) | |
33 | 33 | then { | |
34 | 34 | let h = g | |
35 | 35 | h | |
36 | 36 | } | |
37 | 37 | else 0 | |
38 | 38 | } | |
39 | 39 | let m = e("waves_usd_2") | |
40 | 40 | let n = (j.amount * 100) | |
41 | 41 | let o = (l + j.amount) | |
42 | 42 | ScriptResult(WriteSet([DataEntry((k + "_uscoin"), o)]), TransferSet([ScriptTransfer(i.caller, n, a)])) | |
43 | 43 | } | |
44 | 44 | else throw("can hodl USCoin only at the moment") | |
45 | 45 | else { | |
46 | 46 | let k = toBase58String(i.caller.bytes) | |
47 | 47 | let l = { | |
48 | 48 | let g = getInteger(this, (k + "_waves")) | |
49 | 49 | if ($isInstanceOf(g, "Int")) | |
50 | 50 | then { | |
51 | 51 | let h = g | |
52 | 52 | h | |
53 | 53 | } | |
54 | 54 | else 0 | |
55 | 55 | } | |
56 | - | let m = e("waves_usd_2") | |
56 | + | let m = { | |
57 | + | let g = getInteger(d, "waves_usd_2") | |
58 | + | if ($isInstanceOf(g, "Int")) | |
59 | + | then { | |
60 | + | let h = g | |
61 | + | h | |
62 | + | } | |
63 | + | else 0 | |
64 | + | } | |
57 | 65 | let n = j.amount | |
58 | 66 | let o = (l + j.amount) | |
59 | 67 | ScriptResult(WriteSet([DataEntry((k + "_waves"), o)]), TransferSet([ScriptTransfer(i.caller, n, a)])) | |
60 | 68 | } | |
61 | 69 | } | |
62 | 70 | ||
63 | 71 | ||
64 | 72 | ||
65 | 73 | @Callable(i) | |
66 | 74 | func withdrawUSCoin () = { | |
67 | 75 | let j = extract(i.payment) | |
68 | 76 | if (isDefined(j.assetId)) | |
69 | 77 | then if ((j.assetId == a)) | |
70 | 78 | then { | |
71 | 79 | let k = toBase58String(i.caller.bytes) | |
72 | 80 | let l = { | |
73 | 81 | let g = getInteger(this, (k + "_uscoin")) | |
74 | 82 | if ($isInstanceOf(g, "Int")) | |
75 | 83 | then { | |
76 | 84 | let h = g | |
77 | 85 | h | |
78 | 86 | } | |
79 | 87 | else 0 | |
80 | 88 | } | |
81 | 89 | let m = e("waves_usd_2") | |
82 | 90 | let n = (j.amount / 100) | |
83 | 91 | let o = (l - n) | |
84 | 92 | if ((0 > j.amount)) | |
85 | 93 | then throw("Can't withdraw negative amount") | |
86 | 94 | else if ((0 > o)) | |
87 | 95 | then throw("Not enough USCoin Deposited") | |
88 | 96 | else ScriptResult(WriteSet([DataEntry((k + "_uscoin"), o)]), TransferSet([ScriptTransfer(i.caller, n, b)])) | |
89 | 97 | } | |
90 | 98 | else throw("You Can Withdraw with EUCoin only") | |
91 | 99 | else throw("You Can Withdraw with EUCoin only") | |
92 | 100 | } | |
93 | 101 | ||
94 | 102 | ||
95 | 103 | ||
96 | 104 | @Callable(i) | |
97 | 105 | func withdrawWaves () = { | |
98 | 106 | let j = extract(i.payment) | |
99 | 107 | if (isDefined(j.assetId)) | |
100 | 108 | then if ((j.assetId == a)) | |
101 | 109 | then { | |
102 | 110 | let k = toBase58String(i.caller.bytes) | |
103 | 111 | let l = { | |
104 | 112 | let g = getInteger(this, (k + "_waves")) | |
105 | 113 | if ($isInstanceOf(g, "Int")) | |
106 | 114 | then { | |
107 | 115 | let h = g | |
108 | 116 | h | |
109 | 117 | } | |
110 | 118 | else 0 | |
111 | 119 | } | |
112 | 120 | let m = e("waves_usd_2") | |
113 | 121 | let n = j.amount | |
114 | 122 | let o = (l - n) | |
115 | 123 | if ((0 > j.amount)) | |
116 | 124 | then throw("Can't withdraw negative amount") | |
117 | 125 | else if ((0 > o)) | |
118 | 126 | then throw("Not enough Waves Deposited") | |
119 | 127 | else ScriptResult(WriteSet([DataEntry((k + "_waves"), o)]), TransferSet([ScriptTransfer(i.caller, n, unit)])) | |
120 | 128 | } | |
121 | 129 | else throw("You Can Withdraw with EUCoin only") | |
122 | 130 | else throw("You Can Withdraw with EUCoin only") | |
123 | 131 | } | |
124 | 132 | ||
125 | 133 | ||
126 | 134 | ||
127 | 135 | @Callable(i) | |
128 | 136 | func getFaucet (p) = { | |
129 | 137 | let k = toBase58String(i.caller.bytes) | |
130 | 138 | let l = { | |
131 | 139 | let g = getInteger(this, (k + "_faucet")) | |
132 | 140 | if ($isInstanceOf(g, "Int")) | |
133 | 141 | then { | |
134 | 142 | let h = g | |
135 | 143 | h | |
136 | 144 | } | |
137 | 145 | else 0 | |
138 | 146 | } | |
139 | 147 | if ((0 > p)) | |
140 | 148 | then throw("Can't withdraw negative amount") | |
141 | 149 | else if ((l > 0)) | |
142 | 150 | then throw("Faucet already taken") | |
143 | 151 | else ScriptResult(WriteSet([DataEntry((k + "_faucet"), p)]), TransferSet([ScriptTransfer(i.caller, p, a)])) | |
144 | 152 | } | |
145 | 153 | ||
146 | 154 | ||
147 | 155 | @Verifier(q) | |
148 | 156 | func r () = { | |
149 | 157 | let g = q | |
150 | 158 | if ($isInstanceOf(g, "SetScriptTransaction")) | |
151 | 159 | then { | |
152 | 160 | let s = g | |
153 | 161 | sigVerify(q.bodyBytes, q.proofs[0], c) | |
154 | 162 | } | |
155 | 163 | else if ($isInstanceOf(g, "DataTransaction")) | |
156 | 164 | then { | |
157 | 165 | let s = g | |
158 | 166 | true | |
159 | 167 | } | |
160 | 168 | else false | |
161 | 169 | } | |
162 | 170 |
github/deemru/w8io/169f3d6 32.83 ms ◑