@@ -120,7 +120,7 @@ void fsm_msgOsmosisSignTx(const OsmosisSignTx *msg) {
120
120
}
121
121
122
122
void fsm_msgOsmosisMsgAck (const OsmosisMsgAck * msg ) {
123
- // Confirm transaction basics
123
+ /** Confirm transaction basics */
124
124
CHECK_PARAM (osmosis_signingIsInited (), "Signing not in progress" );
125
125
126
126
const CoinType * coin = fsm_getCoin (true, "Osmosis" );
@@ -130,6 +130,7 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
130
130
131
131
const OsmosisSignTx * sign_tx = osmosis_getOsmosisSignTx ();
132
132
133
+ /** Confirm required transaction parameters exist */
133
134
if (msg -> has_send ) {
134
135
if (!msg -> send .has_to_address || !msg -> send .has_amount ) {
135
136
osmosis_signAbort ();
@@ -139,9 +140,17 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
139
140
return ;
140
141
}
141
142
142
- char amount_str [40 ];
143
- sprintf (amount_str , "%.6f OSMO" ,
144
- atof (msg -> send .amount ) / pow (10 , OSMOSIS_PRECISION ));
143
+ float amount = atof (msg -> send .amount );
144
+ const char * denom = msg -> send .denom ;
145
+ if (!strcmp (msg -> send .denom , "uosmo" )) {
146
+ amount /= pow (10 , OSMOSIS_PRECISION );
147
+ denom = "OSMO" ;
148
+ }
149
+
150
+ char amount_str [103 ];
151
+ snprintf (amount_str , sizeof (amount_str ) - 1 , "%.6f %s" , amount , denom );
152
+
153
+ /** Confirm transaction parameters on screen */
145
154
if (!confirm_transaction_output (
146
155
ButtonRequestType_ButtonRequest_ConfirmOutput , amount_str ,
147
156
msg -> send .to_address )) {
@@ -169,6 +178,14 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
169
178
layoutHome ();
170
179
return ;
171
180
}
181
+
182
+ float amount = atof (msg -> delegate .amount );
183
+ const char * denom = msg -> delegate .denom ;
184
+ if (!strcmp (msg -> delegate .denom , "uosmo" )) {
185
+ amount /= pow (10 , OSMOSIS_PRECISION );
186
+ denom = "OSMO" ;
187
+ }
188
+
172
189
/** Confirm transaction parameters on-screen */
173
190
if (!confirm_osmosis_address ("Confirm Delegator Address" ,
174
191
msg -> delegate .delegator_address )) {
@@ -187,8 +204,7 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
187
204
}
188
205
189
206
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Confirm Amount" ,
190
- "%.6f OSMO" ,
191
- atof (msg -> delegate .amount ) / pow (10 , OSMOSIS_PRECISION ))) {
207
+ "%.6f %s" , amount , denom )) {
192
208
osmosis_signAbort ();
193
209
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
194
210
layoutHome ();
@@ -214,8 +230,15 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
214
230
layoutHome ();
215
231
return ;
216
232
}
217
- /** Confirm transaction parameters on-screen */
218
233
234
+ float amount = atof (msg -> undelegate .amount );
235
+ const char * denom = msg -> undelegate .denom ;
236
+ if (!strcmp (msg -> undelegate .denom , "uosmo" )) {
237
+ amount /= pow (10 , OSMOSIS_PRECISION );
238
+ denom = "OSMO" ;
239
+ }
240
+
241
+ /** Confirm transaction parameters on-screen */
219
242
if (!confirm_osmosis_address ("Confirm Delegator Address" ,
220
243
msg -> undelegate .delegator_address )) {
221
244
osmosis_signAbort ();
@@ -233,8 +256,7 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
233
256
}
234
257
235
258
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Confirm Amount" ,
236
- "%.6f OSMO" ,
237
- atof (msg -> undelegate .amount ) / pow (10 , OSMOSIS_PRECISION ))) {
259
+ "%.6f %s" , amount , denom )) {
238
260
osmosis_signAbort ();
239
261
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
240
262
layoutHome ();
@@ -263,7 +285,6 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
263
285
return ;
264
286
}
265
287
266
- /** Confirm transaction parameters on-screen */
267
288
char insoamt [33 ] = {0 };
268
289
uint8_t outsoamt [34 ] = {0 };
269
290
strlcpy (insoamt , msg -> lp_add .share_out_amount ,
@@ -277,24 +298,31 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
277
298
return ;
278
299
}
279
300
301
+ float amount_in_max_b = atof (msg -> lp_add .amount_in_max_b );
302
+ const char * denom_in_max_b = msg -> lp_add .denom_in_max_b ;
303
+ if (!strcmp (msg -> lp_add .denom_in_max_b , "uosmo" )) {
304
+ amount_in_max_b /= pow (10 , OSMOSIS_PRECISION );
305
+ denom_in_max_b = "OSMO" ;
306
+ }
307
+
308
+ float amount_in_max_a = atof (msg -> lp_add .amount_in_max_a );
309
+ const char * denom_in_max_a = msg -> lp_add .denom_in_max_a ;
310
+ if (!strcmp (msg -> lp_add .denom_in_max_a , "uosmo" )) {
311
+ amount_in_max_a /= pow (10 , OSMOSIS_PRECISION );
312
+ denom_in_max_a = "OSMO" ;
313
+ }
314
+
315
+ /** Confirm transaction parameters on-screen */
280
316
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Add Liquidity" ,
281
- "Deposit %.6f %s and..." ,
282
- atof (msg -> lp_add .amount_in_max_b ) / pow (10 , OSMOSIS_PRECISION ),
283
- (!strcmp (msg -> lp_add .denom_in_max_b , "uosmo" ))
284
- ? "OSMO"
285
- : msg -> lp_add .denom_in_max_b )) {
317
+ "Deposit %.6f %s and..." , amount_in_max_b , denom_in_max_b )) {
286
318
osmosis_signAbort ();
287
319
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
288
320
layoutHome ();
289
321
return ;
290
322
}
291
323
292
324
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Add Liquidity" ,
293
- "... %.6f %s?" ,
294
- atof (msg -> lp_add .amount_in_max_a ) / pow (10 , OSMOSIS_PRECISION ),
295
- (!strcmp (msg -> lp_add .denom_in_max_a , "uosmo" ))
296
- ? "OSMO"
297
- : msg -> lp_add .denom_in_max_a )) {
325
+ "... %.6f %s?" , amount_in_max_a , denom_in_max_a )) {
298
326
osmosis_signAbort ();
299
327
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
300
328
layoutHome ();
@@ -344,7 +372,6 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
344
372
return ;
345
373
}
346
374
347
- /** Confirm transaction parameters on-screen */
348
375
char insoamt [33 ] = {0 };
349
376
uint8_t outsoamt [34 ] = {0 };
350
377
strlcpy (insoamt , msg -> lp_remove .share_in_amount ,
@@ -358,26 +385,32 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
358
385
return ;
359
386
}
360
387
361
- if (!confirm (
362
- ButtonRequestType_ButtonRequest_Other , "Remove Liquidity" ,
363
- "Withdraw %.6f %s and..." ,
364
- atof (msg -> lp_remove .amount_out_min_b ) / pow (10 , OSMOSIS_PRECISION ),
365
- (!strcmp (msg -> lp_remove .denom_out_min_b , "uosmo" ))
366
- ? "OSMO"
367
- : msg -> lp_remove .denom_out_min_b )) {
388
+ float amount_out_min_b = atof (msg -> lp_remove .amount_out_min_b );
389
+ const char * denom_out_min_b = msg -> lp_remove .denom_out_min_b ;
390
+ if (!strcmp (msg -> lp_remove .denom_out_min_b , "uosmo" )) {
391
+ amount_out_min_b /= pow (10 , OSMOSIS_PRECISION );
392
+ denom_out_min_b = "OSMO" ;
393
+ }
394
+
395
+ float amount_out_min_a = atof (msg -> lp_remove .amount_out_min_a );
396
+ const char * denom_out_min_a = msg -> lp_remove .denom_out_min_a ;
397
+ if (!strcmp (msg -> lp_remove .denom_out_min_a , "uosmo" )) {
398
+ amount_out_min_a /= pow (10 , OSMOSIS_PRECISION );
399
+ denom_out_min_a = "OSMO" ;
400
+ }
401
+
402
+ /** Confirm transaction parameters on-screen */
403
+ if (!confirm (ButtonRequestType_ButtonRequest_Other , "Remove Liquidity" ,
404
+ "Withdraw %.6f %s and..." , amount_out_min_b ,
405
+ denom_out_min_b )) {
368
406
osmosis_signAbort ();
369
407
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
370
408
layoutHome ();
371
409
return ;
372
410
}
373
411
374
- if (!confirm (
375
- ButtonRequestType_ButtonRequest_Other , "Remove Liquidity" ,
376
- "... %.6f %s ?" ,
377
- atof (msg -> lp_remove .amount_out_min_a ) / pow (10 , OSMOSIS_PRECISION ),
378
- (!strcmp (msg -> lp_remove .denom_out_min_a , "uosmo" ))
379
- ? "OSMO"
380
- : msg -> lp_remove .denom_out_min_a )) {
412
+ if (!confirm (ButtonRequestType_ButtonRequest_Other , "Remove Liquidity" ,
413
+ "... %.6f %s ?" , amount_out_min_a , denom_out_min_a )) {
381
414
osmosis_signAbort ();
382
415
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
383
416
layoutHome ();
@@ -424,11 +457,12 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
424
457
layoutHome ();
425
458
return ;
426
459
}
427
- /** Confirm transaction parameters on-screen */
428
460
461
+ float amount = atof (msg -> redelegate .amount ) / pow (10 , OSMOSIS_PRECISION );
462
+
463
+ /** Confirm transaction parameters on-screen */
429
464
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Redelegate" ,
430
- "Redelegate %.6f OSMO?" ,
431
- atof (msg -> send .amount ) / pow (10 , OSMOSIS_PRECISION ))) {
465
+ "Redelegate %.6f OSMO?" , amount )) {
432
466
osmosis_signAbort ();
433
467
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
434
468
layoutHome ();
@@ -480,6 +514,7 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
480
514
return ;
481
515
}
482
516
517
+ /** Confirm transaction parameters on-screen */
483
518
if (!confirm (ButtonRequestType_ButtonRequest_Other , "Claim Rewards" ,
484
519
"Claim all available rewards?" )) {
485
520
osmosis_signAbort ();
@@ -525,15 +560,24 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
525
560
return ;
526
561
}
527
562
528
- /** Confirm transaction parameters on-screen */
563
+ float token_in_amount = atof (msg -> swap .token_in_amount );
564
+ const char * token_in_denom = msg -> swap .token_in_denom ;
565
+ if (!strcmp (msg -> swap .token_in_denom , "uosmo" )) {
566
+ token_in_amount /= pow (10 , OSMOSIS_PRECISION );
567
+ token_in_denom = "OSMO" ;
568
+ }
569
+
570
+ float token_out_min_amount = atof (msg -> swap .token_out_min_amount );
571
+ const char * token_out_denom = msg -> swap .token_out_denom ;
572
+ if (!strcmp (msg -> swap .token_out_denom , "uosmo" )) {
573
+ token_out_min_amount /= pow (10 , OSMOSIS_PRECISION );
574
+ token_out_denom = "OSMO" ;
575
+ }
529
576
530
- if (!confirm (
531
- ButtonRequestType_ButtonRequest_Other , "Swap" ,
532
- "Swap %.6f %s for at least %.6f %s?" ,
533
- atof (msg -> swap .token_in_amount ) / pow (10 , OSMOSIS_PRECISION ),
534
- msg -> swap .token_in_denom ,
535
- atof (msg -> swap .token_out_min_amount ) / pow (10 , OSMOSIS_PRECISION ),
536
- msg -> swap .token_out_denom )) {
577
+ /** Confirm transaction parameters on-screen */
578
+ if (!confirm (ButtonRequestType_ButtonRequest_Other , "Swap" ,
579
+ "Swap %.6f %s for at least %.6f %s?" , token_in_amount ,
580
+ token_in_denom , token_out_min_amount , token_out_denom )) {
537
581
osmosis_signAbort ();
538
582
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
539
583
layoutHome ();
@@ -573,12 +617,17 @@ void fsm_msgOsmosisMsgAck(const OsmosisMsgAck *msg) {
573
617
layoutHome ();
574
618
return ;
575
619
}
576
- /** Confirm transaction parameters on-screen */
577
620
621
+ float amount = atof (msg -> ibc_transfer .amount );
622
+ const char * denom = msg -> ibc_transfer .denom ;
623
+ if (!strcmp (msg -> ibc_transfer .denom , "uosmo" )) {
624
+ amount /= pow (10 , OSMOSIS_PRECISION );
625
+ denom = "OSMO" ;
626
+ }
627
+
628
+ /** Confirm transaction parameters on-screen */
578
629
if (!confirm (ButtonRequestType_ButtonRequest_Other , "IBC Transfer" ,
579
- "Transfer %.6f %s?" ,
580
- atof (msg -> ibc_transfer .amount ) / pow (10 , OSMOSIS_PRECISION ),
581
- msg -> ibc_transfer .denom )) {
630
+ "Transfer %.6f %s?" , amount , denom )) {
582
631
osmosis_signAbort ();
583
632
fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
584
633
layoutHome ();
0 commit comments