Starkex v2 integration

This commit is contained in:
BTChip github
2020-11-24 00:11:55 +01:00
committed by TamtamHero
parent 61424e7907
commit 9854d12753
24 changed files with 1056 additions and 183 deletions

View File

@@ -55,6 +55,21 @@ bool check_token_binding(char* ticker1, char* ticker2, const ticker_binding_t* b
return false;
}
bool erc20_plugin_available_check() {
if (quantumSet) {
switch(dataContext.tokenContext.quantumType) {
case STARK_QUANTUM_LEGACY:
case STARK_QUANTUM_ETH:
case STARK_QUANTUM_ERC20:
case STARK_QUANTUM_MINTABLE_ERC20:
return true;
default:
return false;
}
}
return true;
}
void erc20_plugin_call(int message, void *parameters) {
switch(message) {

View File

@@ -0,0 +1,146 @@
#include <string.h>
#include "eth_plugin_internal.h"
#include "eth_plugin_handler.h"
#include "shared_context.h"
#include "ethUtils.h"
#include "utils.h"
void starkware_print_stark_key(uint8_t *starkKey, char *destination);
void starkware_print_eth_address(uint8_t *address, char *destination);
typedef struct erc721_parameters_t {
uint8_t selectorIndex;
uint8_t address[20];
uint8_t tokenId[32];
//tokenDefinition_t *tokenSelf;
//tokenDefinition_t *tokenAddress;
} erc721_parameters_t;
bool erc721_plugin_available_check() {
if (quantumSet) {
switch(dataContext.tokenContext.quantumType) {
case STARK_QUANTUM_ERC721:
case STARK_QUANTUM_MINTABLE_ERC721:
return true;
default:
return false;
}
}
return false;
}
void erc721_plugin_call(int message, void *parameters) {
switch(message) {
case ETH_PLUGIN_INIT_CONTRACT: {
ethPluginInitContract_t *msg = (ethPluginInitContract_t*)parameters;
erc721_parameters_t *context = (erc721_parameters_t*)msg->pluginContext;
// enforce that ETH amount should be 0
if (!allzeroes(msg->pluginSharedRO->txContent->value.value, 32)){
PRINTF("Err: Transaction amount is not 0 for erc721 approval\n");
msg->result = ETH_PLUGIN_RESULT_ERROR;
}
else {
size_t i;
for (i=0; i<NUM_ERC721_SELECTORS; i++) {
if (memcmp((uint8_t *)PIC(ERC721_SELECTORS[i]), msg->selector, SELECTOR_SIZE) == 0) {
context->selectorIndex = i;
break;
}
}
if (i == NUM_ERC721_SELECTORS) {
PRINTF("Unknown erc721 selector %.*H\n", SELECTOR_SIZE, msg->selector);
break;
}
if (msg->dataSize != 4 + 32 + 32) {
PRINTF("Invalid erc721 approval data size %d\n", msg->dataSize);
break;
}
PRINTF("erc721 plugin init\n");
msg->result = ETH_PLUGIN_RESULT_OK;
}
}
break;
case ETH_PLUGIN_PROVIDE_PARAMETER : {
ethPluginProvideParameter_t *msg = (ethPluginProvideParameter_t*)parameters;
erc721_parameters_t *context = (erc721_parameters_t*)msg->pluginContext;
PRINTF("erc721 plugin provide parameter %d %.*H\n", msg->parameterOffset, 32, msg->parameter);
switch(msg->parameterOffset) {
case 4:
memmove(context->address, msg->parameter + 32 - 20, 20);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32:
memmove(context->tokenId, msg->parameter, 32);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
default:
PRINTF("Unhandled parameter offset\n");
break;
}
}
break;
case ETH_PLUGIN_FINALIZE: {
ethPluginFinalize_t *msg = (ethPluginFinalize_t*)parameters;
erc721_parameters_t *context = (erc721_parameters_t*)msg->pluginContext;
PRINTF("erc721 plugin finalize\n");
msg->tokenLookup1 = msg->pluginSharedRO->txContent->destination;
msg->tokenLookup2 = context->address;
msg->numScreens = 3;
msg->uiType = ETH_UI_TYPE_GENERIC;
msg->result = ETH_PLUGIN_RESULT_OK;
}
break;
case ETH_PLUGIN_PROVIDE_TOKEN: {
ethPluginProvideToken_t *msg = (ethPluginProvideToken_t*)parameters;
erc721_parameters_t *context = (erc721_parameters_t*)msg->pluginContext;
PRINTF("erc721 plugin provide token dest: %d - address: %d\n", (msg->token1 != NULL), (msg->token2 != NULL));
//context->tokenSelf = msg->token1;
//context->tokenAddress = msg->token2;
msg->result = ETH_PLUGIN_RESULT_OK;
}
break;
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
ethQueryContractID_t *msg = (ethQueryContractID_t*)parameters;
strcpy(msg->name, "Allowance");
strcpy(msg->version, "");
msg->result = ETH_PLUGIN_RESULT_OK;
}
break;
case ETH_PLUGIN_QUERY_CONTRACT_UI: {
ethQueryContractUI_t *msg = (ethQueryContractUI_t*)parameters;
erc721_parameters_t *context = (erc721_parameters_t*)msg->pluginContext;
switch(msg->screenIndex) {
case 0:
strcpy(msg->title, "Contract Name");
starkware_print_eth_address(tmpContent.txContent.destination, msg->msg);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 1:
strcpy(msg->title, "NFT Contract");
starkware_print_eth_address(context->address, msg->msg);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 2:
strcpy(msg->title, "TokenID");
starkware_print_stark_key(context->tokenId, msg->msg);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
default:
break;
}
}
break;
default:
PRINTF("Unhandled message %d\n", message);
}
}

View File

@@ -16,33 +16,47 @@ typedef enum {
STARKWARE_FULL_WITHDRAW,
STARKWARE_FREEZE,
STARKWARE_ESCAPE,
STARKWARE_VERIFY_ESCAPE
STARKWARE_VERIFY_ESCAPE,
STARKWARE_WITHDRAW_TO,
STARKWARE_DEPOSIT_NFT,
STARKWARE_DEPOSIT_NFT_RECLAIM,
STARKWARE_WITHDRAW_AND_MINT,
STARKWARE_WITHDRAW_NFT,
STARKWARE_WITHDRAW_NFT_TO
} starkwareSelector_t;
// register : starkkey (32), drop param 2
// register : address (20), stark key (32), drop param 3
// Registration
// Contract Name
// From ETH address
// Master account
// deposit token : verify tokenId (32), vaultId (4), quantized Amount (32)
// deposit token : stark key (32), verify assetType (32), vaultId (4), quantized Amount (32)
// Deposit
// Contract Name
// Master Account
// Token Account
// Amount
// deposit : verify tokenId (32), vaultId (4)
// deposit : stark key (32), verify assetType (32), vaultId (4)
// Flow similar to deposit
// deposit cancel, deposit reclaim : tokenId (32) ignored, vaultId(4)
// full withdrawal, freeze : vaultId (4)
// deposit cancel, deposit reclaim : stark key (32), assetType (reclaim) / assetId (cancel) (32) ignored, vaultId(4)
// full withdrawal, freeze : stark key (32), vaultId (4)
// Cancel Deposit | Reclaim Deposit | Full Withdrawal | Freeze
// Contract Name
// Master Account
// Token Account
// withdrawal : verify tokenId (32)
// withdrawal : stark key (32), verify assetType (32)
// Withdrawal
// Contract Name
// Master Account
// To Eth Address
// Token Symbol
// escape : starkkey (32), vaultId (4), verify tokenId (32), quantized Amount (32)
// withdrawal to : stark key (32), verify assetType (32), address (20)
// Withdrawal To
// Contract Name
// Master Account
// To Eth Address
// Token Symbol
// escape : stark key (32), vaultId (4), verify assetType (32), quantized Amount (32)
// Escape
// Contract Name
// Amount
@@ -51,31 +65,77 @@ typedef enum {
// verify escape : escapeProof (ignore)
// Verify Escape
// Contract Name
// deposit NFT : stark key (32), verify assetType (32), vault id (4), token id (32)
// Deposit
// Contract Name
// Master Account
// Token Account
// NFT Contract
// Token ID
// deposit NFT reclaim : stark key (32), verify assetType (32), vault id (4), token id (32)
// Reclaim Deposit
// Contract Name
// Master Account
// Token Account
// NFT Contract
// Token ID
// withdraw and mint : stark key (32), verify assetType (32), mintable blob (ignored variable)
// Withdrawal
// Contract Name
// Master Account
// Asset Contract
// withdraw NFT : stark key (32), verify assetType (32), token id (32)
// Withdrawal
// Contract Name
// Master Account
// To Eth Address
// NFT Contract
// Token ID
// withdraw NFT To : stark key (32), verify assetType (32), token id (32), address (20)
// Withdrawal To
// Contract Name
// Master Account
// To Eth Address
// NFT Contract
// Token ID
static const uint8_t STARKWARE_EXPECTED_DATA_SIZE[] = {
4 + 32,
0,
4 + 32 + 32 + 32 + 32,
4 + 32 + 32 + 32,
4 + 32 + 32 + 32,
4 + 32 + 32 + 32,
4 + 32 + 32,
4 + 32 + 32,
4 + 32 + 32,
4 + 32,
4 + 32,
4 + 32,
4 + 32 + 32 + 32 + 32,
0
0,
4 + 32 + 32 + 32,
4 + 32 + 32 + 32 + 32,
4 + 32 + 32 + 32 + 32,
0,
4 + 32 + 32 + 32,
4 + 32 + 32 + 32 + 32
};
static const uint8_t STARKWARE_NUM_SCREENS[] = {
4 - 1,
4 - 1,
4 - 1,
3 - 1,
3 - 1,
4 - 1,
3 - 1,
3 - 1,
5 - 1,
2 - 1
5 - 1,
4 - 1,
4 - 1,
5 - 1,
4 - 1,
4 - 1,
5 - 1,
2 - 1,
5 - 1,
6 - 1,
6 - 1,
4 - 1,
6 - 1,
6 - 1
};
typedef struct starkware_parameters_t {
@@ -89,7 +149,7 @@ typedef struct starkware_parameters_t {
} starkware_parameters_t;
// TODO : rewrite as independant code
bool starkware_verify_token_id(uint8_t *tmp32, uint8_t *tokenId) {
bool starkware_verify_asset_id(uint8_t *tmp32, uint8_t *tokenId, bool assetTypeOnly) {
if (quantumSet) {
cx_sha3_t sha3;
tokenDefinition_t *currentToken = NULL;
@@ -99,7 +159,9 @@ bool starkware_verify_token_id(uint8_t *tmp32, uint8_t *tokenId) {
cx_keccak_init(&sha3, 256);
compute_token_id(&sha3,
(currentToken != NULL ? currentToken->address : NULL),
dataContext.tokenContext.quantum, tmp32);
dataContext.tokenContext.quantumType,
dataContext.tokenContext.quantum,
dataContext.tokenContext.mintingBlob, assetTypeOnly, tmp32);
if (memcmp(tokenId, tmp32, 32) != 0) {
PRINTF("Token ID not matching - computed %.*H\n", 32, tmp32);
PRINTF("Current quantum %.*H\n", 32, dataContext.tokenContext.quantum);
@@ -114,6 +176,27 @@ bool starkware_verify_token_id(uint8_t *tmp32, uint8_t *tokenId) {
return true;
}
bool starkware_verify_nft_token_id(uint8_t *tokenId) {
if (!quantumSet) {
PRINTF("Quantum not set\n");
return false;
}
switch(dataContext.tokenContext.quantumType) {
case STARK_QUANTUM_ERC721:
case STARK_QUANTUM_MINTABLE_ERC721:
break;
default:
PRINTF("Unexpected quantum type for NFT token id check %d\n", dataContext.tokenContext.quantumType);
return false;
}
if (memcmp(dataContext.tokenContext.quantum, tokenId, 32) != 0) {
PRINTF("Token ID not matching - expected %.*H\n", 32, dataContext.tokenContext.quantum);
PRINTF("Current token ID %.*H\n", 32, tokenId);
return false;
}
return true;
}
void starkware_print_vault_id(uint32_t vaultId, char *destination) {
snprintf(destination, 10, "%d", vaultId);
}
@@ -169,6 +252,18 @@ void starkware_print_ticker(char *destination) {
strcpy(destination, ticker);
}
// TODO : rewrite as independant code
void starkware_print_asset_contract(char *destination) {
// token has been validated to be present previously
if (dataContext.tokenContext.quantumIndex != MAX_TOKEN) {
tokenDefinition_t *token = &tmpCtx.transactionContext.tokens[dataContext.tokenContext.quantumIndex];
starkware_print_eth_address(token->address, destination);
}
else {
strcpy(destination, "UNKNOWN");
}
}
// TODO : rewrite as independant code
void starkware_get_source_address(char *destination) {
uint8_t privateKeyData[32];
@@ -229,75 +324,134 @@ void starkware_plugin_call(int message, void *parameters) {
break;
}
switch(msg->parameterOffset) {
case 4:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
case STARKWARE_ESCAPE:
memmove(context->starkKey, msg->parameter, 32);
memmove(context->amount, msg->parameter + 32 - 20, 20);
break;
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
break;
case STARKWARE_WITHDRAW:
case STARKWARE_FULL_WITHDRAW:
case STARKWARE_FREEZE:
memmove(context->vaultId, msg->parameter + 32 - 4, 4);
break;
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_WITHDRAW:
context->validToken = starkware_verify_token_id(context->amount, msg->parameter);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32:
switch(context->selectorIndex) {
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_ESCAPE:
memmove(context->vaultId, msg->parameter + 32 - 4, 4);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32 + 32:
switch(context->selectorIndex) {
case STARKWARE_DEPOSIT_TOKEN:
memmove(context->amount, msg->parameter, 32);
break;
case STARKWARE_ESCAPE:
context->validToken = starkware_verify_token_id(context->amount, msg->parameter);
break;
case STARKWARE_WITHDRAW_TO:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
case STARKWARE_WITHDRAW_AND_MINT:
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
memmove(context->starkKey, msg->parameter, 32);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32 + 32 + 32:
switch(context->selectorIndex) {
case STARKWARE_ESCAPE:
memmove(context->amount, msg->parameter, 32);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
memmove(context->starkKey, msg->parameter, 32);
break;
case STARKWARE_ESCAPE:
memmove(context->vaultId, msg->parameter + 32 - 4, 4);
break;
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
break;
case STARKWARE_FULL_WITHDRAW:
case STARKWARE_FREEZE:
memmove(context->vaultId, msg->parameter + 32 - 4, 4);
break;
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_WITHDRAW:
case STARKWARE_WITHDRAW_TO:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
case STARKWARE_WITHDRAW_AND_MINT:
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
context->validToken = starkware_verify_asset_id(context->amount, msg->parameter, true);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32 + 32:
switch(context->selectorIndex) {
case STARKWARE_ESCAPE:
context->validToken = starkware_verify_asset_id(context->amount, msg->parameter, true);
break;
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
memmove(context->vaultId, msg->parameter + 32 - 4, 4);
break;
case STARKWARE_WITHDRAW_TO:
memmove(context->amount, msg->parameter + 32 - 20, 20);
break;
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
context->validToken = starkware_verify_nft_token_id(msg->parameter);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4 + 32 + 32 + 32:
switch(context->selectorIndex) {
case STARKWARE_ESCAPE:
case STARKWARE_DEPOSIT_TOKEN:
memmove(context->amount, msg->parameter, 32);
break;
case STARKWARE_WITHDRAW_NFT_TO:
memmove(context->amount, msg->parameter + 32 - 20, 20);
break;
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
context->validToken = starkware_verify_nft_token_id(msg->parameter);
break;
default:
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
default:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
case STARKWARE_VERIFY_ESCAPE:
msg->result = ETH_PLUGIN_RESULT_OK;
msg->result = ETH_PLUGIN_RESULT_OK;
break;
default:
PRINTF("Unhandled parameter offset\n");
break;
@@ -331,15 +485,19 @@ void starkware_plugin_call(int message, void *parameters) {
break;
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_NFT:
strcpy(msg->name, "Deposit");
break;
case STARKWARE_DEPOSIT_CANCEL:
strcpy(msg->name, "Cancel Deposit");
break;
case STARKWARE_DEPOSIT_RECLAIM:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
strcpy(msg->name, "Reclaim Deposit");
break;
case STARKWARE_WITHDRAW:
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_AND_MINT:
strcpy(msg->name, "Withdrawal");
break;
case STARKWARE_FULL_WITHDRAW:
@@ -354,6 +512,11 @@ void starkware_plugin_call(int message, void *parameters) {
case STARKWARE_VERIFY_ESCAPE:
strcpy(msg->name, "Verify Escape");
break;
case STARKWARE_WITHDRAW_TO:
case STARKWARE_WITHDRAW_NFT_TO:
strcpy(msg->name, "Withdrawal To");
break;
default:
break;
}
@@ -371,44 +534,85 @@ void starkware_plugin_call(int message, void *parameters) {
starkware_print_eth_address(tmpContent.txContent.destination, msg->msg);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 1:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
strcpy(msg->title, "From ETH Address");
starkware_get_source_address(msg->msg);
break;
case STARKWARE_REGISTER:
strcpy(msg->title, "From ETH Address");
starkware_print_eth_address(context->amount, msg->msg);
break;
case STARKWARE_ESCAPE:
strcpy(msg->title, "Amount");
starkware_print_amount(context->amount, msg->msg, true);
break;
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
case STARKWARE_WITHDRAW:
case STARKWARE_FULL_WITHDRAW:
case STARKWARE_FREEZE:
case STARKWARE_VERIFY_ESCAPE:
case STARKWARE_WITHDRAW_TO:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
case STARKWARE_WITHDRAW_AND_MINT:
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
strcpy(msg->title, "Master Account");
starkware_print_stark_key(context->starkKey, msg->msg);
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 2:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
case STARKWARE_ESCAPE:
strcpy(msg->title, "Master Account");
starkware_print_stark_key(context->starkKey, msg->msg);
break;
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_ETH:
case STARKWARE_DEPOSIT_CANCEL:
case STARKWARE_DEPOSIT_RECLAIM:
case STARKWARE_FULL_WITHDRAW:
case STARKWARE_FREEZE:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
strcpy(msg->title, "Token Account");
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
break;
case STARKWARE_WITHDRAW:
case STARKWARE_WITHDRAW_NFT:
strcpy(msg->title, "To ETH Address");
starkware_get_source_address(msg->msg);
break;
case STARKWARE_ESCAPE:
strcpy(msg->title, "Amount");
starkware_print_amount(context->amount, msg->msg, true);
case STARKWARE_WITHDRAW_TO:
case STARKWARE_WITHDRAW_NFT_TO:
strcpy(msg->title, "To ETH Address");
starkware_print_eth_address(context->amount, msg->msg);
break;
case STARKWARE_WITHDRAW_AND_MINT:
strcpy(msg->title, "Asset Contract");
starkware_print_asset_contract(msg->msg);
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 2:
switch(context->selectorIndex) {
case STARKWARE_REGISTER:
case 3:
switch(context->selectorIndex) {
case STARKWARE_ESCAPE:
strcpy(msg->title, "Master Account");
PRINTF("Master account %s\n", msg->msg);
starkware_print_stark_key(context->starkKey, msg->msg);
strcpy(msg->title, "Token Account");
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
break;
case STARKWARE_DEPOSIT_TOKEN:
case STARKWARE_DEPOSIT_ETH:
@@ -418,22 +622,19 @@ void starkware_plugin_call(int message, void *parameters) {
msg->msg, false);
break;
case STARKWARE_WITHDRAW:
case STARKWARE_WITHDRAW_TO:
strcpy(msg->title, "Token Symbol");
starkware_print_ticker(msg->msg);
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 3:
switch(context->selectorIndex) {
case STARKWARE_ESCAPE:
strcpy(msg->title, "Token Account");
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
break;
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
strcpy(msg->title, "NFT Contract");
starkware_print_asset_contract(msg->msg);
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
@@ -441,6 +642,24 @@ void starkware_plugin_call(int message, void *parameters) {
msg->result = ETH_PLUGIN_RESULT_OK;
break;
case 4:
switch(context->selectorIndex) {
case STARKWARE_WITHDRAW_NFT:
case STARKWARE_WITHDRAW_NFT_TO:
case STARKWARE_DEPOSIT_NFT:
case STARKWARE_DEPOSIT_NFT_RECLAIM:
strcpy(msg->title, "TokenID");
starkware_print_stark_key(dataContext.tokenContext.quantum, msg->msg);
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
}
msg->result = ETH_PLUGIN_RESULT_OK;
break;
default:
PRINTF("Unexpected screen %d for %d\n", msg->screenIndex, context->selectorIndex);
break;
@@ -453,4 +672,4 @@ void starkware_plugin_call(int message, void *parameters) {
}
}
#endif
#endif