Skip to content

Commit

Permalink
Merge pull request #261 from keepkey/exchange-display
Browse files Browse the repository at this point in the history
refine 0x exchange confirms
  • Loading branch information
markrypto authored Mar 24, 2021
2 parents d14d350 + 6aaf991 commit 902cd3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deps/python-keepkey
18 changes: 9 additions & 9 deletions lib/firmware/ethereum_contracts/zxswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ bool zx_confirmZxSwap(uint32_t data_total, const EthereumSignTx *msg) {
const TokenType *from, *to;
uint8_t *fromAddress, *toAddress;
char constr1[40], constr2[40];
uint32_t numOfTokens, adder;
uint32_t numOfTokens, adder, isSushi;
char *exchange;

numOfTokens = read_be(msg->data_initial_chunk.bytes + 4 + 5*32 - 4);
isSushi = read_be(msg->data_initial_chunk.bytes + 4 + 4*32 - 4);
if (isSushi == 0) {
exchange = "Uniswap";
} else {
exchange = "Sushiswap";
}

switch (numOfTokens) {
case 2:
Expand All @@ -70,13 +77,6 @@ bool zx_confirmZxSwap(uint32_t data_total, const EthereumSignTx *msg) {

from = tokenByChainAddress(msg->chain_id, fromAddress);
to = tokenByChainAddress(msg->chain_id, toAddress);

snprintf(constr1, 20, "%s for %s", from->ticker, to->ticker);

if (!confirm(ButtonRequestType_ButtonRequest_ConfirmOutput, "Uniswap",
"Confirm Uniswap Swap:\n%s", constr1)) {
return false;
}

// Get token trade amount data
bignum256 sellTokenAmount, minBuyTokenAmount;
Expand All @@ -93,7 +93,7 @@ bool zx_confirmZxSwap(uint32_t data_total, const EthereumSignTx *msg) {
snprintf(constr1, 32, "%s", sellToken);
snprintf(constr2, 32, "%s", minBuyToken);

return confirm(ButtonRequestType_ButtonRequest_ConfirmOutput, "Uniswap",
return confirm(ButtonRequestType_ButtonRequest_ConfirmOutput, exchange,
"Sell %s\nBuy at least %s", constr1, constr2);

return true;
Expand Down

0 comments on commit 902cd3a

Please sign in to comment.