-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d467248
commit 62d00ab
Showing
6 changed files
with
42 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "manage_asset_info.h" | ||
|
||
void reset_known_tokens(void) { | ||
memset(tmpCtx.transactionContext.tokenSet, 0, MAX_ITEMS); | ||
} | ||
|
||
extraInfo_t *get_asset_info(const uint8_t *contractAddress) { | ||
// Works for ERC-20 & NFT tokens since both structs in the union have the | ||
// contract address aligned | ||
for (uint8_t i = 0; i < MAX_ITEMS; i++) { | ||
extraInfo_t *currentItem = &tmpCtx.transactionContext.extraInfo[i]; | ||
if (tmpCtx.transactionContext.tokenSet[i] && | ||
(memcmp(currentItem->token.address, contractAddress, ADDRESS_LENGTH) == 0)) { | ||
PRINTF("Token found at index %d\n", i); | ||
return currentItem; | ||
} | ||
} | ||
|
||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "shared_context.h" | ||
#include "common_utils.h" | ||
#include "asset_info.h" | ||
|
||
void reset_known_tokens(void); | ||
|
||
extraInfo_t *get_asset_info(const uint8_t *contractAddress); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters