Skip to content

Commit cb6e8dd

Browse files
authored
feat(legacy): add support for safe transaction parsing (#171)
* feat(legacy): add support for safe transaction parsing * feat(legacy): add support for ERC20 approve * feat(legacy): optimize passphrase input method toggle * feat(legacy): add some EVM and solana built-in tokens
1 parent 01d2929 commit cb6e8dd

33 files changed

+3523
-5018
lines changed

common/defs/evm_tokens/1.json

Lines changed: 588 additions & 1287 deletions
Large diffs are not rendered by default.

common/defs/evm_tokens/137.json

Lines changed: 199 additions & 1143 deletions
Large diffs are not rendered by default.

common/defs/evm_tokens/42161.json

Lines changed: 290 additions & 788 deletions
Large diffs are not rendered by default.

common/defs/evm_tokens/56.json

Lines changed: 200 additions & 1143 deletions
Large diffs are not rendered by default.

common/defs/evm_tokens/8453.json

Lines changed: 298 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,304 @@
33
"chain": "Base",
44
"tokens": [
55
{
6-
"name": "USD Coin",
7-
"symbol": "USDC",
8-
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
9-
"decimals": 6
10-
},
11-
{
12-
"name": "Bridged Tether USD",
13-
"symbol": "USDT",
14-
"address": "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2",
15-
"decimals": 6
16-
},
17-
{
18-
"name": "Wrapped Ether",
19-
"symbol": "WETH",
206
"address": "0x4200000000000000000000000000000000000006",
21-
"decimals": 18
22-
},
23-
{
24-
"name": "Dai Stablecoin",
25-
"symbol": "DAI",
26-
"address": "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
27-
"decimals": 18
28-
}
7+
"symbol": "WETH",
8+
"name": "Wrapped Ether",
9+
"decimals": "18"
10+
},
11+
{
12+
"address": "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca",
13+
"symbol": "USDbC",
14+
"name": "USD Base Coin",
15+
"decimals": "6"
16+
},
17+
{
18+
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
19+
"symbol": "USDC",
20+
"name": "USD Coin",
21+
"decimals": "6"
22+
},
23+
{
24+
"address": "0x0555e30da8f98308edb960aa94c0db47230d2b9c",
25+
"symbol": "WBTC",
26+
"name": "Wrapped BTC",
27+
"decimals": "8"
28+
},
29+
{
30+
"address": "0x88fb150bdc53a65fe94dea0c9ba0a6daf8c6e196",
31+
"symbol": "LINK",
32+
"name": "ChainLink Token",
33+
"decimals": "18"
34+
},
35+
{
36+
"address": "0x04c0599ae5a44757c0af6f9ec3b93da8976c150a",
37+
"symbol": "weETH",
38+
"name": "Wrapped eETH",
39+
"decimals": "18"
40+
},
41+
{
42+
"address": "0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34",
43+
"symbol": "USDe",
44+
"name": "USDe",
45+
"decimals": "18"
46+
},
47+
{
48+
"address": "0x820c137fa70c8691f0e44dc420a5e53c168921dc",
49+
"symbol": "USDS",
50+
"name": "USDS Stablecoin",
51+
"decimals": "18"
52+
},
53+
{
54+
"address": "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf",
55+
"symbol": "cbBTC",
56+
"name": "Coinbase Wrapped BTC",
57+
"decimals": "8"
58+
},
59+
{
60+
"address": "0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2",
61+
"symbol": "sUSDe",
62+
"name": "Staked USDe",
63+
"decimals": "18"
64+
},
65+
{
66+
"address": "0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8",
67+
"symbol": "DOT",
68+
"name": "Polkadot Token (Relay Chain)",
69+
"decimals": "18"
70+
},
71+
{
72+
"address": "0x5875eee11cf8398102fdad704c9e96607675467a",
73+
"symbol": "sUSDS",
74+
"name": "Savings USDS",
75+
"decimals": "18"
76+
},
77+
{
78+
"address": "0x63706e401c06ac8513145b7687a14804d17f814b",
79+
"symbol": "AAVE",
80+
"name": "Aave Token",
81+
"decimals": "18"
82+
},
83+
{
84+
"address": "0x58538e6a46e07434d7e7375bc268d3cb839c0133",
85+
"symbol": "ENA",
86+
"name": "ENA",
87+
"decimals": "18"
88+
},
89+
{
90+
"address": "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c",
91+
"symbol": "rETH",
92+
"name": "Rocket Pool ETH",
93+
"decimals": "18"
94+
},
95+
{
96+
"address": "0x00f3c42833c3170159af4e92dbb451fb3f708917",
97+
"symbol": "ICP",
98+
"name": "ICP",
99+
"decimals": "8"
100+
},
101+
{
102+
"address": "0xb29749498954a3a821ec37bde86e386df3ce30b6",
103+
"symbol": "LsETH",
104+
"name": "Liquid Staked ETH",
105+
"decimals": "18"
106+
},
107+
{
108+
"address": "0xecac9c5f704e954931349da37f60e39f515c11c1",
109+
"symbol": "LBTC",
110+
"name": "Lombard Staked Bitcoin",
111+
"decimals": "8"
112+
},
113+
{
114+
"address": "0x2416092f143378750bb29b79ed961ab195cceea5",
115+
"symbol": "ezETH",
116+
"name": "Renzo Restaked ETH",
117+
"decimals": "18"
118+
},
119+
{
120+
"address": "0x3b86ad95859b6ab773f55f8d94b4b9d443ee931f",
121+
"symbol": "SolvBTC",
122+
"name": "Solv BTC",
123+
"decimals": "18"
124+
},
125+
{
126+
"address": "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842",
127+
"symbol": "MORPHO",
128+
"name": "Morpho Token",
129+
"decimals": "18"
130+
},
131+
{
132+
"address": "0x940181a94a35a4569e4529a3cdfb74e38fd98631",
133+
"symbol": "AERO",
134+
"name": "Aerodrome",
135+
"decimals": "18"
136+
},
137+
{
138+
"address": "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b",
139+
"symbol": "VIRTUAL",
140+
"name": "Virtual Protocol",
141+
"decimals": "18"
142+
},
143+
{
144+
"address": "0x1045971c168b5294acbc8727a4f1c9e1af99f6d0",
145+
"symbol": "FTN",
146+
"name": "Bridged FTN (OrtakSea)",
147+
"decimals": "18"
148+
},
149+
{
150+
"address": "0x8d2757ea27aabf172da4cca4e5474c76016e3dc5",
151+
"symbol": "clBTC",
152+
"name": "clBTC",
153+
"decimals": "18"
154+
},
155+
{
156+
"address": "0x50da645f148798f68ef2d7db7c1cb22a6819bb2c",
157+
"symbol": "SPX",
158+
"name": "SPX6900",
159+
"decimals": "8"
160+
},
161+
{
162+
"address": "0x3055913c90fcc1a6ce9a358911721eeb942013a1",
163+
"symbol": "Cake",
164+
"name": "PancakeSwap Token",
165+
"decimals": "18"
166+
},
167+
{
168+
"address": "0xf587b7116879a529353cc71ee959cd69fd5cae48",
169+
"symbol": "cgETH.hashkey",
170+
"name": "cgETH Hashkey Cloud",
171+
"decimals": "18"
172+
},
173+
{
174+
"address": "0x8ee73c484a26e0a5df2ee2a4960b789967dd0415",
175+
"symbol": "CRV",
176+
"name": "Curve DAO Token",
177+
"decimals": "18"
178+
},
179+
{
180+
"address": "0xf3527ef8de265eaa3716fb312c12847bfba66cef",
181+
"symbol": "USDX",
182+
"name": "Wrapped USDX",
183+
"decimals": "18"
184+
},
185+
{
186+
"address": "0x236aa50979d5f3de3bd1eeb40e81137f22ab794b",
187+
"symbol": "tBTC",
188+
"name": "Base tBTC v2",
189+
"decimals": "18"
190+
},
191+
{
192+
"address": "0x758a3e0b1f842c9306b783f8a4078c6c8c03a270",
193+
"symbol": "USD0",
194+
"name": "Usual USD",
195+
"decimals": "18"
196+
},
197+
{
198+
"address": "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
199+
"symbol": "cbETH",
200+
"name": "Coinbase Wrapped Staked ETH",
201+
"decimals": "18"
202+
},
203+
{
204+
"address": "0x6c240dda6b5c336df09a4d011139beaaa1ea2aa2",
205+
"symbol": "ETHFI",
206+
"name": "ether.fi governance token",
207+
"decimals": "18"
208+
},
209+
{
210+
"address": "0xa99f6e6785da0f5d6fb42495fe424bce029eeb3e",
211+
"symbol": "PENDLE",
212+
"name": "Pendle",
213+
"decimals": "18"
214+
},
215+
{
216+
"address": "0x688aee022aa544f150678b8e5720b6b96a9e9a2f",
217+
"symbol": "SYRUP",
218+
"name": "Syrup Token",
219+
"decimals": "18"
220+
},
221+
{
222+
"address": "0x6bb7a212910682dcfdbd5bcbb3e28fb4e8da10ee",
223+
"symbol": "GHO",
224+
"name": "Gho Token",
225+
"decimals": "18"
226+
},
227+
{
228+
"address": "0x2081ab0d9ec9e4303234ab26d86b20b3367946ee",
229+
"symbol": "EIGEN",
230+
"name": "Eigen",
231+
"decimals": "18"
232+
},
233+
{
234+
"address": "0x70654aad8b7734dc319d0c3608ec7b32e03fa162",
235+
"symbol": "satUSD",
236+
"name": "Satoshi Stablecoin V2",
237+
"decimals": "18"
238+
},
239+
{
240+
"address": "0x99ac4484e8a1dbd6a185380b3a811913ac884d87",
241+
"symbol": "sDAI",
242+
"name": "Savings Dai",
243+
"decimals": "18"
244+
},
245+
{
246+
"address": "0xa0769f7a8fc65e47de93797b4e21c073c117fc80",
247+
"symbol": "EUTBL",
248+
"name": "Spiko EU T-Bills Money Market Fund",
249+
"decimals": "5"
250+
},
251+
{
252+
"address": "0x060cb087a9730e13aa191f31a6d86bff8dfcdcc0",
253+
"symbol": "OHM",
254+
"name": "Olympus",
255+
"decimals": "9"
256+
},
257+
{
258+
"address": "0x22e6966b799c4d5b13be962e1d117b56327fda66",
259+
"symbol": "SNX",
260+
"name": "Synthetix Network Token",
261+
"decimals": "18"
262+
},
263+
{
264+
"address": "0xa4a2e2ca3fbfe21aed83471d28b6f65a233c6e00",
265+
"symbol": "TIBBIR",
266+
"name": "Ribbita by Virtuals",
267+
"decimals": "18"
268+
},
269+
{
270+
"address": "0xd09acb80c1e8f2291862c4978a008791c9167003",
271+
"symbol": "tETH",
272+
"name": "Treehouse ETH",
273+
"decimals": "18"
274+
},
275+
{
276+
"address": "0x61e030a56d33e8260fdd81f03b162a79fe3449cd",
277+
"symbol": "FLUID",
278+
"name": "Fluid",
279+
"decimals": "18"
280+
},
281+
{
282+
"address": "0x9e1028f5f1d5ede59748ffcee5532509976840e0",
283+
"symbol": "COMP",
284+
"name": "Compound",
285+
"decimals": "18"
286+
},
287+
{
288+
"address": "0x1111111111166b7fe7bd91427724b487980afc69",
289+
"symbol": "ZORA",
290+
"name": "Zora",
291+
"decimals": "18"
292+
},
293+
{
294+
"address": "0x09be1692ca16e06f536f0038ff11d1da8524adb1",
295+
"symbol": "TEL",
296+
"name": "Telcoin",
297+
"decimals": "2"
298+
},
299+
{
300+
"address": "0xc26c9099bd3789107888c35bb41178079b282561",
301+
"symbol": "SolvBTC.BBN",
302+
"name": "SolvBTC Babylon",
303+
"decimals": "18"
304+
}
29305
]
30306
}

common/protob/messages-ethereum-eip712-onekey.proto

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,37 @@ message EthereumTypedDataValueAckOneKey {
8888
// * array types: number of elements, encoded as uint16.
8989
// * struct types: undefined, Trezor will not query a struct field.
9090
}
91+
92+
enum EthereumGnosisSafeTxOperation {
93+
CALL = 0;
94+
DELEGATE_CALL = 1;
95+
}
96+
97+
/**
98+
* Request: Ask device for Gnosis Safe transaction data
99+
* @start
100+
* @next EthereumGnosisSafeTxAck
101+
* @next Failure
102+
*/
103+
message EthereumGnosisSafeTxRequest {
104+
}
105+
/**
106+
* Request: the Gnosis Safe transaction data
107+
* @start
108+
* @next EthereumTypedDataSignatureOneKey
109+
* @next Failure
110+
*/
111+
message EthereumGnosisSafeTxAck {
112+
required string to = 1;
113+
required bytes value = 2;
114+
optional bytes data = 3;
115+
required EthereumGnosisSafeTxOperation operation = 4;
116+
required bytes safeTxGas = 5;
117+
required bytes baseGas = 6;
118+
required bytes gasPrice = 7;
119+
required string gasToken = 8;
120+
required string refundReceiver = 9;
121+
required bytes nonce = 10;
122+
required uint64 chain_id = 11;
123+
required string verifyingContract = 12;
124+
}

common/protob/messages.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ enum MessageType {
229229
MessageType_EthereumTypedDataValueAckOneKey = 20115 [(wire_in) = true, (wire_no_fsm) = true];
230230
MessageType_EthereumTypedDataSignatureOneKey = 20116 [(wire_out) = true];
231231
MessageType_EthereumSignTypedHashOneKey = 20117 [(wire_in) = true];
232-
reserved 20118, 20119;
232+
MessageType_EthereumGnosisSafeTxAck = 20118 [(wire_in) = true, (wire_no_fsm) = true];
233+
MessageType_EthereumGnosisSafeTxRequest = 20119 [(wire_out) = true];
233234
MessageType_EthereumSignTxEIP7702OneKey = 20120 [(wire_in) = true];
234235
// NEM
235236
MessageType_NEMGetAddress = 67 [(wire_in) = true];

legacy/buttons.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,19 @@ bool hasbutton(void) {
328328
}
329329
return false;
330330
}
331-
331+
void clearButtonState(void) {
332+
button.UpUp = false;
333+
button.DownUp = false;
334+
button.YesUp = false;
335+
button.NoUp = false;
336+
}
332337
uint8_t keyScan(void) {
333338
delay_ms(5);
334339
buttonUpdate();
340+
if (!button.UpUp && (button.UpDown > SHAKE_DELAY) &&
341+
(!button.DownUp && (button.DownDown > SHAKE_DELAY))) {
342+
return KEY_COMBO_UP_DOWN;
343+
}
335344
if (button.YesUp)
336345
return KEY_CONFIRM;
337346
else if (button.NoUp)

0 commit comments

Comments
 (0)