tx · 5otf7xvxDDPkYwxckjFVuxsdUB5fzGh8gKvDshrErJtA 3N2sRWeWnMTXiS1ip6WwQcr54LUjxjBNdP1: -0.01300000 Waves 2023.05.02 09:54 [2559810] smart account 3N2sRWeWnMTXiS1ip6WwQcr54LUjxjBNdP1 > SELF 0.00000000 Waves
{ "type": 13, "id": "5otf7xvxDDPkYwxckjFVuxsdUB5fzGh8gKvDshrErJtA", "fee": 1300000, "feeAssetId": null, "timestamp": 1683010465134, "version": 2, "chainId": 84, "sender": "3N2sRWeWnMTXiS1ip6WwQcr54LUjxjBNdP1", "senderPublicKey": "DEnu4Lzkx2FVXHJ6PZBWsEshWeUpdpYtdsBerfEhqHv8", "proofs": [ "2FJHUvb29VLwLZfuSwwRhU2b4QgaoTmLTVufo4jApVUW8VpWVrkw9Fm7QwWEEtLb6b5fUw2JwMbHMQgWCvGuse65" ], "script": "base64:BgIICAISABIAEgAPAAxjb250cmFjdEZpbGUCD3Byb3h5X3BlcGUucmlkZQARa2V5c1dhdmVzQ29udHJhY3QCEiVzX19zV2F2ZXNDb250cmFjdAAQa2V5c1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQBD2dldFN0cmluZ09yRmFpbAEDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwUDa2V5CQCsAgICFU5vIGRhdGEgZm9yIHRoaXMua2V5PQUDa2V5ARNwZXBlQ29udHJhY3RBZGRyZXNzAAkBD2dldFN0cmluZ09yRmFpbAEFEWtleXNXYXZlc0NvbnRyYWN0AQ5zV2F2ZXNJZFN0cmluZwAJAQ9nZXRTdHJpbmdPckZhaWwBBRBrZXlzV2F2ZXNBc3NldElkAAxwZXBlQ29udHJhY3QJARFAZXh0ck5hdGl2ZSgxMDYyKQEJARNwZXBlQ29udHJhY3RBZGRyZXNzAAAGc1dhdmVzCQDZBAEJAQ5zV2F2ZXNJZFN0cmluZwABE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19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0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleRS1W1Q=", "height": 2559810, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DMi8ki3A2z2YWPdvMMneMBMdhyrrcbNiWXBWyesHacBa Next: none Diff:
Old | New | Differences | |
---|---|---|---|
23 | 23 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
24 | 24 | ||
25 | 25 | ||
26 | - | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
26 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
27 | + | ||
28 | + | ||
29 | + | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
27 | 30 | ||
28 | 31 | ||
29 | 32 | func error (msg) = throw(((contractFile + ": ") + msg)) | |
30 | 33 | ||
31 | 34 | ||
32 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
33 | - | case s: String => | |
34 | - | fromBase58String(s) | |
35 | - | case _: Unit => | |
36 | - | unit | |
37 | - | case _ => | |
38 | - | throw("Match error") | |
39 | - | } | |
40 | - | ||
41 | - | ||
42 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
43 | - | case s: String => | |
44 | - | fromBase58String(s) | |
45 | - | case _: Unit => | |
46 | - | unit | |
47 | - | case _ => | |
48 | - | throw("Match error") | |
49 | - | } | |
35 | + | func managerPublicKeyOrUnit () = { | |
36 | + | let managerVaultAddress = getManagerAddressOrFail() | |
37 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
38 | + | case s: String => | |
39 | + | fromBase58String(s) | |
40 | + | case _: Unit => | |
41 | + | unit | |
42 | + | case _ => | |
43 | + | throw("Match error") | |
44 | + | } | |
45 | + | } | |
50 | 46 | ||
51 | 47 | ||
52 | 48 | func isManager (i) = match managerPublicKeyOrUnit() { | |
114 | 110 | } | |
115 | 111 | ||
116 | 112 | ||
117 | - | ||
118 | - | @Callable(i) | |
119 | - | func setManager (pendingManagerPublicKey) = { | |
120 | - | let checkCaller = mustManager(i) | |
121 | - | if ((checkCaller == checkCaller)) | |
122 | - | then { | |
123 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
124 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
125 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
126 | - | else throw("Strict value is not equal to itself.") | |
127 | - | } | |
128 | - | else throw("Strict value is not equal to itself.") | |
129 | - | } | |
130 | - | ||
131 | - | ||
132 | - | ||
133 | - | @Callable(i) | |
134 | - | func confirmManager () = { | |
135 | - | let pm = pendingManagerPublicKeyOrUnit() | |
136 | - | let hasPM = if (isDefined(pm)) | |
137 | - | then true | |
138 | - | else throw("no pending manager") | |
139 | - | if ((hasPM == hasPM)) | |
140 | - | then { | |
141 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
142 | - | then true | |
143 | - | else throw("you are not pending manager") | |
144 | - | if ((checkPM == checkPM)) | |
145 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
146 | - | else throw("Strict value is not equal to itself.") | |
147 | - | } | |
148 | - | else throw("Strict value is not equal to itself.") | |
149 | - | } | |
150 | - | ||
151 | - | ||
152 | 113 | @Verifier(tx) | |
153 | 114 | func verify () = { | |
154 | 115 | let targetPublicKey = match managerPublicKeyOrUnit() { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "proxy_pepe.ride" | |
5 | 5 | ||
6 | 6 | let keysWavesContract = "%s__sWavesContract" | |
7 | 7 | ||
8 | 8 | let keysWavesAssetId = "%s__sWavesAssetId" | |
9 | 9 | ||
10 | 10 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func pepeContractAddress () = getStringOrFail(keysWavesContract) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func sWavesIdString () = getStringOrFail(keysWavesAssetId) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | let pepeContract = addressFromStringValue(pepeContractAddress()) | |
20 | 20 | ||
21 | 21 | let sWaves = fromBase58String(sWavesIdString()) | |
22 | 22 | ||
23 | 23 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
24 | 24 | ||
25 | 25 | ||
26 | - | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
26 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
27 | + | ||
28 | + | ||
29 | + | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
27 | 30 | ||
28 | 31 | ||
29 | 32 | func error (msg) = throw(((contractFile + ": ") + msg)) | |
30 | 33 | ||
31 | 34 | ||
32 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
33 | - | case s: String => | |
34 | - | fromBase58String(s) | |
35 | - | case _: Unit => | |
36 | - | unit | |
37 | - | case _ => | |
38 | - | throw("Match error") | |
39 | - | } | |
40 | - | ||
41 | - | ||
42 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
43 | - | case s: String => | |
44 | - | fromBase58String(s) | |
45 | - | case _: Unit => | |
46 | - | unit | |
47 | - | case _ => | |
48 | - | throw("Match error") | |
49 | - | } | |
35 | + | func managerPublicKeyOrUnit () = { | |
36 | + | let managerVaultAddress = getManagerAddressOrFail() | |
37 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
38 | + | case s: String => | |
39 | + | fromBase58String(s) | |
40 | + | case _: Unit => | |
41 | + | unit | |
42 | + | case _ => | |
43 | + | throw("Match error") | |
44 | + | } | |
45 | + | } | |
50 | 46 | ||
51 | 47 | ||
52 | 48 | func isManager (i) = match managerPublicKeyOrUnit() { | |
53 | 49 | case pk: ByteVector => | |
54 | 50 | (i.callerPublicKey == pk) | |
55 | 51 | case _: Unit => | |
56 | 52 | (i.caller == this) | |
57 | 53 | case _ => | |
58 | 54 | throw("Match error") | |
59 | 55 | } | |
60 | 56 | ||
61 | 57 | ||
62 | 58 | func mustManager (i) = if (isManager(i)) | |
63 | 59 | then true | |
64 | 60 | else throw("permission denied") | |
65 | 61 | ||
66 | 62 | ||
67 | 63 | @Callable(i) | |
68 | 64 | func getRate () = { | |
69 | 65 | let results = invoke(pepeContract, "getRate", nil, nil) | |
70 | 66 | match results { | |
71 | 67 | case t: String => | |
72 | 68 | $Tuple2(nil, parseIntValue(t)) | |
73 | 69 | case _ => | |
74 | 70 | error("getRate(): unexpected return") | |
75 | 71 | } | |
76 | 72 | } | |
77 | 73 | ||
78 | 74 | ||
79 | 75 | ||
80 | 76 | @Callable(i) | |
81 | 77 | func deposit () = { | |
82 | 78 | let startBalance = assetBalance(this, sWaves) | |
83 | 79 | if ((startBalance == startBalance)) | |
84 | 80 | then { | |
85 | 81 | let results = invoke(pepeContract, "deposit", nil, i.payments) | |
86 | 82 | if ((results == results)) | |
87 | 83 | then { | |
88 | 84 | let newBalance = assetBalance(this, sWaves) | |
89 | 85 | let sendAmount = (newBalance - startBalance) | |
90 | 86 | $Tuple2([ScriptTransfer(i.caller, sendAmount, sWaves)], sendAmount) | |
91 | 87 | } | |
92 | 88 | else throw("Strict value is not equal to itself.") | |
93 | 89 | } | |
94 | 90 | else throw("Strict value is not equal to itself.") | |
95 | 91 | } | |
96 | 92 | ||
97 | 93 | ||
98 | 94 | ||
99 | 95 | @Callable(i) | |
100 | 96 | func withdraw () = { | |
101 | 97 | let startBalance = wavesBalance(this).available | |
102 | 98 | if ((startBalance == startBalance)) | |
103 | 99 | then { | |
104 | 100 | let results = invoke(pepeContract, "withdraw", nil, i.payments) | |
105 | 101 | if ((results == results)) | |
106 | 102 | then { | |
107 | 103 | let newBalance = wavesBalance(this).available | |
108 | 104 | let sendAmount = (newBalance - startBalance) | |
109 | 105 | $Tuple2([ScriptTransfer(i.caller, sendAmount, unit)], sendAmount) | |
110 | 106 | } | |
111 | 107 | else throw("Strict value is not equal to itself.") | |
112 | 108 | } | |
113 | 109 | else throw("Strict value is not equal to itself.") | |
114 | 110 | } | |
115 | 111 | ||
116 | 112 | ||
117 | - | ||
118 | - | @Callable(i) | |
119 | - | func setManager (pendingManagerPublicKey) = { | |
120 | - | let checkCaller = mustManager(i) | |
121 | - | if ((checkCaller == checkCaller)) | |
122 | - | then { | |
123 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
124 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
125 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
126 | - | else throw("Strict value is not equal to itself.") | |
127 | - | } | |
128 | - | else throw("Strict value is not equal to itself.") | |
129 | - | } | |
130 | - | ||
131 | - | ||
132 | - | ||
133 | - | @Callable(i) | |
134 | - | func confirmManager () = { | |
135 | - | let pm = pendingManagerPublicKeyOrUnit() | |
136 | - | let hasPM = if (isDefined(pm)) | |
137 | - | then true | |
138 | - | else throw("no pending manager") | |
139 | - | if ((hasPM == hasPM)) | |
140 | - | then { | |
141 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
142 | - | then true | |
143 | - | else throw("you are not pending manager") | |
144 | - | if ((checkPM == checkPM)) | |
145 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
146 | - | else throw("Strict value is not equal to itself.") | |
147 | - | } | |
148 | - | else throw("Strict value is not equal to itself.") | |
149 | - | } | |
150 | - | ||
151 | - | ||
152 | 113 | @Verifier(tx) | |
153 | 114 | func verify () = { | |
154 | 115 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
155 | 116 | case pk: ByteVector => | |
156 | 117 | pk | |
157 | 118 | case _: Unit => | |
158 | 119 | tx.senderPublicKey | |
159 | 120 | case _ => | |
160 | 121 | throw("Match error") | |
161 | 122 | } | |
162 | 123 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
163 | 124 | } | |
164 | 125 |
github/deemru/w8io/fabc49c 27.65 ms ◑