Fix all the defects identified by Clang Static Analyzer
Some fixes are dirty, but it is a start to enforce scan-build on every commit. Signed-off-by: pscott <scott.piriou@ledger.fr>
This commit is contained in:
committed by
pscott
parent
c27d59d792
commit
cd78581ffd
@@ -30,7 +30,7 @@ static const uint8_t COMPOUND_EXPECTED_DATA_SIZE[] = {
|
||||
typedef struct compound_parameters_t {
|
||||
uint8_t selectorIndex;
|
||||
uint8_t amount[32];
|
||||
uint8_t ticker_1[MAX_TICKER_LEN];
|
||||
char ticker_1[MAX_TICKER_LEN];
|
||||
uint8_t decimals;
|
||||
} compound_parameters_t;
|
||||
|
||||
@@ -153,15 +153,15 @@ void compound_plugin_call(int message, void *parameters) {
|
||||
compound_parameters_t *context = (compound_parameters_t *) msg->pluginContext;
|
||||
PRINTF("compound plugin provide token: %d\n", (msg->token1 != NULL));
|
||||
if (msg->token1 != NULL) {
|
||||
strcpy((char *) context->ticker_1, (char *) msg->token1->ticker);
|
||||
strlcpy(context->ticker_1, msg->token1->ticker, MAX_TICKER_LEN);
|
||||
switch (context->selectorIndex) {
|
||||
case COMPOUND_REDEEM_UNDERLYING:
|
||||
case COMPOUND_MINT:
|
||||
case CETH_MINT:
|
||||
msg->result = get_underlying_asset_decimals((char *) &context->ticker_1,
|
||||
&context->decimals)
|
||||
? ETH_PLUGIN_RESULT_OK
|
||||
: ETH_PLUGIN_RESULT_FALLBACK;
|
||||
msg->result =
|
||||
get_underlying_asset_decimals(context->ticker_1, &context->decimals)
|
||||
? ETH_PLUGIN_RESULT_OK
|
||||
: ETH_PLUGIN_RESULT_FALLBACK;
|
||||
break;
|
||||
|
||||
// Only case where we use the compound contract decimals
|
||||
@@ -182,22 +182,22 @@ void compound_plugin_call(int message, void *parameters) {
|
||||
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
|
||||
ethQueryContractID_t *msg = (ethQueryContractID_t *) parameters;
|
||||
compound_parameters_t *context = (compound_parameters_t *) msg->pluginContext;
|
||||
strcpy(msg->name, "Type");
|
||||
strlcpy(msg->name, "Type", msg->nameLength);
|
||||
switch (context->selectorIndex) {
|
||||
case COMPOUND_REDEEM_UNDERLYING:
|
||||
case COMPOUND_REDEEM:
|
||||
strcpy(msg->version, "Redeem");
|
||||
strlcpy(msg->version, "Redeem", msg->versionLength);
|
||||
break;
|
||||
|
||||
case COMPOUND_MINT:
|
||||
case CETH_MINT:
|
||||
strcpy(msg->version, "Lend");
|
||||
strlcpy(msg->version, "Lend", msg->versionLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
strcat(msg->version, " Assets");
|
||||
strlcat(msg->version, " Assets", msg->versionLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
|
||||
@@ -206,8 +206,8 @@ void compound_plugin_call(int message, void *parameters) {
|
||||
compound_parameters_t *context = (compound_parameters_t *) msg->pluginContext;
|
||||
switch (msg->screenIndex) {
|
||||
case 0: {
|
||||
strcpy(msg->title, "Amount");
|
||||
char *ticker_ptr = (char *) context->ticker_1;
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
char *ticker_ptr = context->ticker_1;
|
||||
/* skip "c" in front of cToken unless we use "redeem", as
|
||||
redeem is the only operation dealing with a cToken amount */
|
||||
if (context->selectorIndex != COMPOUND_REDEEM) {
|
||||
@@ -223,11 +223,11 @@ void compound_plugin_call(int message, void *parameters) {
|
||||
} break;
|
||||
|
||||
case 1:
|
||||
strcpy(msg->title, "Contract");
|
||||
strcpy(msg->msg, "Compound ");
|
||||
strcat(msg->msg,
|
||||
(char *) context->ticker_1 +
|
||||
1); // remove the 'c' char at beginning of compound ticker
|
||||
strlcpy(msg->title, "Contract", msg->titleLength);
|
||||
strlcpy(msg->msg, "Compound ", msg->msgLength);
|
||||
strlcat(msg->msg,
|
||||
context->ticker_1 + 1,
|
||||
msg->msgLength); // remove the 'c' char at beginning of compound ticker
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -16,10 +16,10 @@ typedef struct erc20_parameters_t {
|
||||
uint8_t selectorIndex;
|
||||
uint8_t destinationAddress[21];
|
||||
uint8_t amount[INT256_LENGTH];
|
||||
uint8_t ticker[MAX_TICKER_LEN];
|
||||
char ticker[MAX_TICKER_LEN];
|
||||
uint8_t decimals;
|
||||
uint8_t target;
|
||||
uint8_t contract_name[MAX_CONTRACT_NAME_LEN];
|
||||
char contract_name[MAX_CONTRACT_NAME_LEN];
|
||||
} erc20_parameters_t;
|
||||
|
||||
typedef struct contract_t {
|
||||
@@ -58,9 +58,7 @@ bool check_contract(erc20_parameters_t *context) {
|
||||
for (size_t i = 0; i < NUM_CONTRACTS; i++) {
|
||||
contract_t *contract = (contract_t *) PIC(&CONTRACTS[i]);
|
||||
if (memcmp(contract->address, context->destinationAddress, ADDRESS_LENGTH) == 0) {
|
||||
strncpy((char *) context->contract_name,
|
||||
contract->name,
|
||||
sizeof(context->contract_name));
|
||||
strncpy(context->contract_name, contract->name, sizeof(context->contract_name));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +159,7 @@ void erc20_plugin_call(int message, void *parameters) {
|
||||
(msg->token2 != NULL));
|
||||
if (msg->token1 != NULL) {
|
||||
context->target = TARGET_ADDRESS;
|
||||
strcpy((char *) context->ticker, (char *) msg->token1->ticker);
|
||||
strlcpy(context->ticker, msg->token1->ticker, MAX_TICKER_LEN);
|
||||
context->decimals = msg->token1->decimals;
|
||||
if (context->selectorIndex == ERC20_APPROVE) {
|
||||
if (check_contract(context)) {
|
||||
@@ -176,8 +174,8 @@ void erc20_plugin_call(int message, void *parameters) {
|
||||
|
||||
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
|
||||
ethQueryContractID_t *msg = (ethQueryContractID_t *) parameters;
|
||||
strcpy(msg->name, "Type");
|
||||
strcpy(msg->version, "Approve");
|
||||
strlcpy(msg->name, "Type", msg->nameLength);
|
||||
strlcpy(msg->version, "Approve", msg->versionLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
|
||||
@@ -186,15 +184,15 @@ void erc20_plugin_call(int message, void *parameters) {
|
||||
erc20_parameters_t *context = (erc20_parameters_t *) msg->pluginContext;
|
||||
switch (msg->screenIndex) {
|
||||
case 0:
|
||||
strcpy(msg->title, "Amount");
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
if (ismaxint(context->amount, sizeof(context->amount))) {
|
||||
strcpy(msg->msg, "Unlimited ");
|
||||
strcat(msg->msg, (char *) context->ticker);
|
||||
strlcpy(msg->msg, "Unlimited ", msg->msgLength);
|
||||
strlcat(msg->msg, context->ticker, msg->msgLength);
|
||||
} else {
|
||||
amountToString(context->amount,
|
||||
sizeof(context->amount),
|
||||
context->decimals,
|
||||
(char *) context->ticker,
|
||||
context->ticker,
|
||||
msg->msg,
|
||||
100);
|
||||
}
|
||||
@@ -202,10 +200,10 @@ void erc20_plugin_call(int message, void *parameters) {
|
||||
break;
|
||||
case 1:
|
||||
if (context->target >= TARGET_CONTRACT) {
|
||||
strcpy(msg->title, "Contract");
|
||||
strcpy(msg->msg, (char *) context->contract_name);
|
||||
strlcpy(msg->title, "Contract", msg->titleLength);
|
||||
strlcpy(msg->msg, context->contract_name, msg->msgLength);
|
||||
} else {
|
||||
strcpy(msg->title, "Address");
|
||||
strlcpy(msg->title, "Address", msg->titleLength);
|
||||
msg->msg[0] = '0';
|
||||
msg->msg[1] = 'x';
|
||||
getEthAddressStringFromBinary(context->destinationAddress,
|
||||
|
||||
@@ -108,8 +108,8 @@ void erc721_plugin_call(int message, void *parameters) {
|
||||
|
||||
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
|
||||
ethQueryContractID_t *msg = (ethQueryContractID_t *) parameters;
|
||||
strcpy(msg->name, "Allowance");
|
||||
strcpy(msg->version, "");
|
||||
strlcpy(msg->name, "Allowance", msg->nameLength);
|
||||
strlcpy(msg->version, "", msg->versionLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
|
||||
@@ -118,19 +118,19 @@ void erc721_plugin_call(int message, void *parameters) {
|
||||
erc721_parameters_t *context = (erc721_parameters_t *) msg->pluginContext;
|
||||
switch (msg->screenIndex) {
|
||||
case 0:
|
||||
strcpy(msg->title, "Contract Name");
|
||||
strlcpy(msg->title, "Contract Name", msg->titleLength);
|
||||
starkware_print_eth_address(tmpContent.txContent.destination, msg->msg);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
strcpy(msg->title, "NFT Contract");
|
||||
strlcpy(msg->title, "NFT Contract", msg->titleLength);
|
||||
starkware_print_eth_address(context->address, msg->msg);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
strcpy(msg->title, "TokenID");
|
||||
strlcpy(msg->title, "TokenID", msg->titleLength);
|
||||
starkware_print_stark_key(context->tokenId, msg->msg);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
|
||||
@@ -135,7 +135,7 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
msg->pluginSharedRW->sha3);
|
||||
|
||||
// Copy back the string to the global variable.
|
||||
strcpy(context->deposit_address, tmp);
|
||||
strlcpy(context->deposit_address, tmp, ETH2_DEPOSIT_PUBKEY_LENGTH);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
}
|
||||
@@ -198,8 +198,8 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
|
||||
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
|
||||
ethQueryContractID_t *msg = (ethQueryContractID_t *) parameters;
|
||||
strcpy(msg->name, "ETH2");
|
||||
strcpy(msg->version, "Deposit");
|
||||
strlcpy(msg->name, "ETH2", msg->nameLength);
|
||||
strlcpy(msg->version, "Deposit", msg->versionLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
|
||||
@@ -210,7 +210,7 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
case 0: { // Amount screen
|
||||
uint8_t decimals = WEI_TO_ETHER;
|
||||
char *ticker = chainConfig->coinName;
|
||||
strcpy(msg->title, "Amount");
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
amountToString(tmpContent.txContent.value.value,
|
||||
tmpContent.txContent.value.length,
|
||||
decimals,
|
||||
@@ -220,8 +220,8 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
case 1: { // Deposit pubkey screen
|
||||
strcpy(msg->title, "Validator");
|
||||
strcpy(msg->msg, context->deposit_address);
|
||||
strlcpy(msg->title, "Validator", msg->titleLength);
|
||||
strlcpy(msg->msg, context->deposit_address, msg->msgLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -280,18 +280,22 @@ void starkware_print_stark_key(uint8_t *starkKey, char *destination) {
|
||||
}
|
||||
|
||||
// TODO : rewrite as independant code
|
||||
void starkware_print_eth_address(uint8_t *address, char *destination) {
|
||||
void starkware_print_eth_address(uint8_t *address, char *destination, size_t destinationLength) {
|
||||
if (destinationLength < 43) {
|
||||
strlcpy(destination, "ERROR", destinationLength);
|
||||
return;
|
||||
}
|
||||
destination[0] = '0';
|
||||
destination[1] = 'x';
|
||||
getEthAddressStringFromBinary(address,
|
||||
destination + 2,
|
||||
&global_sha3,
|
||||
chainConfig);
|
||||
getEthAddressStringFromBinary(address, destination + 2, &global_sha3, chainConfig);
|
||||
destination[42] = '\0';
|
||||
}
|
||||
|
||||
// TODO : rewrite as independant code
|
||||
void starkware_print_amount(uint8_t *amountData, char *destination, bool forEscape) {
|
||||
void starkware_print_amount(uint8_t *amountData,
|
||||
char *destination,
|
||||
size_t destinationLength,
|
||||
bool forEscape) {
|
||||
uint256_t amount, amountPre, quantum;
|
||||
uint8_t decimals;
|
||||
char *ticker = chainConfig->coinName;
|
||||
@@ -310,7 +314,7 @@ void starkware_print_amount(uint8_t *amountData, char *destination, bool forEsca
|
||||
tokenDefinition_t *token =
|
||||
&tmpCtx.transactionContext.tokens[dataContext.tokenContext.quantumIndex];
|
||||
decimals = token->decimals;
|
||||
ticker = (char *) token->ticker;
|
||||
ticker = token->ticker;
|
||||
readu256BE(amountData, &amountPre);
|
||||
}
|
||||
if (amountData != NULL) {
|
||||
@@ -318,35 +322,35 @@ void starkware_print_amount(uint8_t *amountData, char *destination, bool forEsca
|
||||
mul256(&amountPre, &quantum, &amount);
|
||||
}
|
||||
tostring256(&amount, 10, (char *) (G_io_apdu_buffer + 100), 100);
|
||||
strcpy(destination, ticker);
|
||||
strlcpy(destination, ticker, destinationLength);
|
||||
adjustDecimals((char *) (G_io_apdu_buffer + 100),
|
||||
strlen((char *) (G_io_apdu_buffer + 100)),
|
||||
destination + strlen(ticker),
|
||||
50 - strlen(ticker),
|
||||
destinationLength - strlen(ticker),
|
||||
decimals);
|
||||
}
|
||||
|
||||
// TODO : rewrite as independant code
|
||||
void starkware_print_ticker(char *destination) {
|
||||
void starkware_print_ticker(char *destination, size_t destinationLength) {
|
||||
char *ticker = chainConfig->coinName;
|
||||
|
||||
if (dataContext.tokenContext.quantumIndex != MAX_TOKEN) {
|
||||
tokenDefinition_t *token =
|
||||
&tmpCtx.transactionContext.tokens[dataContext.tokenContext.quantumIndex];
|
||||
ticker = (char *) token->ticker;
|
||||
ticker = token->ticker;
|
||||
}
|
||||
strcpy(destination, ticker);
|
||||
strlcpy(destination, ticker, destinationLength);
|
||||
}
|
||||
|
||||
// TODO : rewrite as independant code
|
||||
void starkware_print_asset_contract(char *destination) {
|
||||
void starkware_print_asset_contract(char *destination, size_t destinationLength) {
|
||||
// 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);
|
||||
starkware_print_eth_address(token->address, destination, destinationLength);
|
||||
} else {
|
||||
strcpy(destination, "UNKNOWN");
|
||||
strlcpy(destination, "UNKNOWN", destinationLength);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,10 +372,7 @@ void starkware_get_source_address(char *destination) {
|
||||
io_seproxyhal_io_heartbeat();
|
||||
destination[0] = '0';
|
||||
destination[1] = 'x';
|
||||
getEthAddressStringFromKey(&publicKey,
|
||||
destination + 2,
|
||||
&global_sha3,
|
||||
chainConfig);
|
||||
getEthAddressStringFromKey(&publicKey, destination + 2, &global_sha3, chainConfig);
|
||||
destination[42] = '\0';
|
||||
}
|
||||
|
||||
@@ -646,54 +647,55 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
PRINTF("starkware query contract id\n");
|
||||
switch (context->selectorIndex) {
|
||||
case STARKWARE_REGISTER:
|
||||
strcpy(msg->name, "Register");
|
||||
strlcpy(msg->name, "Register", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_DEPOSIT_TOKEN:
|
||||
case STARKWARE_DEPOSIT_ETH:
|
||||
case STARKWARE_DEPOSIT_NFT:
|
||||
case STARKWARE_PROXY_DEPOSIT_TOKEN:
|
||||
case STARKWARE_PROXY_DEPOSIT_ETH:
|
||||
strcpy(msg->name, "Deposit");
|
||||
strlcpy(msg->name, "Deposit", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_DEPOSIT_CANCEL:
|
||||
strcpy(msg->name, "Cancel Deposit");
|
||||
strlcpy(msg->name, "Cancel Deposit", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_DEPOSIT_RECLAIM:
|
||||
case STARKWARE_DEPOSIT_NFT_RECLAIM:
|
||||
strcpy(msg->name, "Reclaim Deposit");
|
||||
strlcpy(msg->name, "Reclaim Deposit", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW:
|
||||
case STARKWARE_WITHDRAW_NFT:
|
||||
case STARKWARE_WITHDRAW_AND_MINT:
|
||||
strcpy(msg->name, "Withdrawal");
|
||||
strlcpy(msg->name, "Withdrawal", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_FULL_WITHDRAW:
|
||||
strcpy(msg->name, "Full Withdrawal");
|
||||
strlcpy(msg->name, "Full Withdrawal", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_FREEZE:
|
||||
strcpy(msg->name, "Freeze");
|
||||
strlcpy(msg->name, "Freeze", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_ESCAPE:
|
||||
strcpy(msg->name, "Escape");
|
||||
strlcpy(msg->name, "Escape", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_VERIFY_ESCAPE:
|
||||
strcpy(msg->name, "Verify Escape");
|
||||
strlcpy(msg->name, "Verify Escape", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW_TO:
|
||||
case STARKWARE_WITHDRAW_NFT_TO:
|
||||
strcpy(msg->name, "Withdrawal To");
|
||||
strlcpy(msg->name, "Withdrawal To", msg->nameLength);
|
||||
break;
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_TOKEN:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_ETH:
|
||||
strcpy(msg->name, "Register&Deposit");
|
||||
strlcpy(msg->name, "Register&Deposit", msg->nameLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
strcpy(msg->version,
|
||||
is_deversify_contract(tmpContent.txContent.destination) ? "DeversiFi"
|
||||
: "Starkware");
|
||||
strlcpy(
|
||||
msg->version,
|
||||
is_deversify_contract(tmpContent.txContent.destination) ? "DeversiFi" : "Starkware",
|
||||
msg->versionLength);
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
} break;
|
||||
|
||||
@@ -702,11 +704,13 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
starkware_parameters_t *context = (starkware_parameters_t *) msg->pluginContext;
|
||||
switch (msg->screenIndex) {
|
||||
case 0:
|
||||
strcpy(msg->title, "Contract Name");
|
||||
strlcpy(msg->title, "Contract Name", msg->titleLength);
|
||||
if (is_deversify_contract(tmpContent.txContent.destination)) {
|
||||
strcpy(msg->msg, "DeversiFi");
|
||||
strlcpy(msg->msg, "DeversiFi", msg->msgLength);
|
||||
} else {
|
||||
starkware_print_eth_address(tmpContent.txContent.destination, msg->msg);
|
||||
starkware_print_eth_address(tmpContent.txContent.destination,
|
||||
msg->msg,
|
||||
msg->msgLength);
|
||||
}
|
||||
msg->result = ETH_PLUGIN_RESULT_OK;
|
||||
break;
|
||||
@@ -715,12 +719,12 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case STARKWARE_REGISTER:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_TOKEN:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_ETH:
|
||||
strcpy(msg->title, "From ETH Address");
|
||||
starkware_print_eth_address(context->amount, msg->msg);
|
||||
strlcpy(msg->title, "From ETH Address", msg->titleLength);
|
||||
starkware_print_eth_address(context->amount, msg->msg, msg->msgLength);
|
||||
break;
|
||||
case STARKWARE_ESCAPE:
|
||||
strcpy(msg->title, "Amount");
|
||||
starkware_print_amount(context->amount, msg->msg, true);
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
starkware_print_amount(context->amount, msg->msg, msg->msgLength, true);
|
||||
break;
|
||||
case STARKWARE_DEPOSIT_TOKEN:
|
||||
case STARKWARE_DEPOSIT_ETH:
|
||||
@@ -738,7 +742,7 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case STARKWARE_WITHDRAW_AND_MINT:
|
||||
case STARKWARE_WITHDRAW_NFT:
|
||||
case STARKWARE_WITHDRAW_NFT_TO:
|
||||
strcpy(msg->title, "Master Account");
|
||||
strlcpy(msg->title, "Master Account", msg->titleLength);
|
||||
starkware_print_stark_key(context->starkKey, msg->msg);
|
||||
break;
|
||||
default:
|
||||
@@ -755,7 +759,7 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case STARKWARE_ESCAPE:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_TOKEN:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_ETH:
|
||||
strcpy(msg->title, "Master Account");
|
||||
strlcpy(msg->title, "Master Account", msg->titleLength);
|
||||
starkware_print_stark_key(context->starkKey, msg->msg);
|
||||
break;
|
||||
|
||||
@@ -769,22 +773,22 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case STARKWARE_FREEZE:
|
||||
case STARKWARE_DEPOSIT_NFT:
|
||||
case STARKWARE_DEPOSIT_NFT_RECLAIM:
|
||||
strcpy(msg->title, "Token Account");
|
||||
strlcpy(msg->title, "Token Account", msg->titleLength);
|
||||
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW:
|
||||
case STARKWARE_WITHDRAW_NFT:
|
||||
strcpy(msg->title, "To ETH Address");
|
||||
strlcpy(msg->title, "To ETH Address", msg->titleLength);
|
||||
starkware_get_source_address(msg->msg);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW_TO:
|
||||
case STARKWARE_WITHDRAW_NFT_TO:
|
||||
strcpy(msg->title, "To ETH Address");
|
||||
starkware_print_eth_address(context->amount, msg->msg);
|
||||
strlcpy(msg->title, "To ETH Address", msg->titleLength);
|
||||
starkware_print_eth_address(context->amount, msg->msg, msg->msgLength);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW_AND_MINT:
|
||||
strcpy(msg->title, "Asset Contract");
|
||||
starkware_print_asset_contract(msg->msg);
|
||||
strlcpy(msg->title, "Asset Contract", msg->titleLength);
|
||||
starkware_print_asset_contract(msg->msg, msg->msgLength);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -799,39 +803,40 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case 3:
|
||||
switch (context->selectorIndex) {
|
||||
case STARKWARE_ESCAPE:
|
||||
strcpy(msg->title, "Token Account");
|
||||
strlcpy(msg->title, "Token Account", msg->titleLength);
|
||||
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
|
||||
break;
|
||||
case STARKWARE_DEPOSIT_TOKEN:
|
||||
case STARKWARE_DEPOSIT_ETH:
|
||||
case STARKWARE_PROXY_DEPOSIT_TOKEN:
|
||||
case STARKWARE_PROXY_DEPOSIT_ETH:
|
||||
strcpy(msg->title, "Amount");
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
starkware_print_amount(
|
||||
(((context->selectorIndex == STARKWARE_DEPOSIT_ETH) ||
|
||||
(context->selectorIndex == STARKWARE_PROXY_DEPOSIT_ETH))
|
||||
? NULL
|
||||
: context->amount),
|
||||
msg->msg,
|
||||
msg->msgLength,
|
||||
false);
|
||||
break;
|
||||
case STARKWARE_WITHDRAW:
|
||||
case STARKWARE_WITHDRAW_TO:
|
||||
strcpy(msg->title, "Token Symbol");
|
||||
starkware_print_ticker(msg->msg);
|
||||
strlcpy(msg->title, "Token Symbol", msg->titleLength);
|
||||
starkware_print_ticker(msg->msg, msg->msgLength);
|
||||
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);
|
||||
strlcpy(msg->title, "NFT Contract", msg->titleLength);
|
||||
starkware_print_asset_contract(msg->msg, msg->msgLength);
|
||||
break;
|
||||
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_TOKEN:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_ETH:
|
||||
strcpy(msg->title, "Token Account");
|
||||
strlcpy(msg->title, "Token Account", msg->titleLength);
|
||||
starkware_print_vault_id(U4BE(context->vaultId, 0), msg->msg);
|
||||
break;
|
||||
|
||||
@@ -850,18 +855,19 @@ void starkware_plugin_call(int message, void *parameters) {
|
||||
case STARKWARE_WITHDRAW_NFT_TO:
|
||||
case STARKWARE_DEPOSIT_NFT:
|
||||
case STARKWARE_DEPOSIT_NFT_RECLAIM:
|
||||
strcpy(msg->title, "TokenID");
|
||||
strlcpy(msg->title, "TokenID", msg->titleLength);
|
||||
starkware_print_stark_key(dataContext.tokenContext.quantum, msg->msg);
|
||||
break;
|
||||
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_TOKEN:
|
||||
case STARKWARE_REGISTER_AND_DEPOSIT_ETH:
|
||||
strcpy(msg->title, "Amount");
|
||||
strlcpy(msg->title, "Amount", msg->titleLength);
|
||||
starkware_print_amount(
|
||||
((context->selectorIndex == STARKWARE_REGISTER_AND_DEPOSIT_ETH)
|
||||
? NULL
|
||||
: context->amount),
|
||||
msg->msg,
|
||||
msg->msgLength,
|
||||
false);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user