Fix issues due to base64(contractAddr) removal
This commit is contained in:
@@ -106,29 +106,27 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,
|
||||
PRINTF("eth_plug_init aborted in swap mode\n");
|
||||
return 0;
|
||||
}
|
||||
for (;;) {
|
||||
PRINTF("eth_plugin_init\n");
|
||||
if (contractAddress != NULL) {
|
||||
PRINTF("Trying address %.*H\n", 20, contractAddress);
|
||||
} else {
|
||||
PRINTF("Trying alias %s\n", dataContext.tokenContext.pluginName);
|
||||
}
|
||||
eth_plugin_result_t status =
|
||||
eth_plugin_call(contractAddress, ETH_PLUGIN_INIT_CONTRACT, (void *) init);
|
||||
if (status <= ETH_PLUGIN_RESULT_UNSUCCESSFUL) {
|
||||
|
||||
eth_plugin_result_t status = ETH_PLUGIN_RESULT_UNAVAILABLE;
|
||||
|
||||
if (contractAddress != NULL) {
|
||||
PRINTF("No plugin available for %.*H\n", 20, contractAddress);
|
||||
return status;
|
||||
} else if (status == ETH_PLUGIN_RESULT_OK_ALIAS) {
|
||||
contractAddress = NULL;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PRINTF("eth_plugin_init\n");
|
||||
PRINTF("Trying plugin %s\n", dataContext.tokenContext.pluginName);
|
||||
status = eth_plugin_call(ETH_PLUGIN_INIT_CONTRACT, (void *) init);
|
||||
|
||||
if (status <= ETH_PLUGIN_RESULT_UNSUCCESSFUL) {
|
||||
return status;
|
||||
}
|
||||
PRINTF("eth_plugin_init ok %s\n", dataContext.tokenContext.pluginName);
|
||||
dataContext.tokenContext.pluginStatus = ETH_PLUGIN_RESULT_OK;
|
||||
return ETH_PLUGIN_RESULT_OK;
|
||||
}
|
||||
|
||||
eth_plugin_result_t eth_plugin_call(uint8_t *contractAddress, int method, void *parameter) {
|
||||
eth_plugin_result_t eth_plugin_call(int method, void *parameter) {
|
||||
ethPluginSharedRW_t pluginRW;
|
||||
ethPluginSharedRO_t pluginRO;
|
||||
char tmp[PLUGIN_ID_LENGTH];
|
||||
@@ -139,16 +137,11 @@ eth_plugin_result_t eth_plugin_call(uint8_t *contractAddress, int method, void *
|
||||
pluginRW.sha3 = &global_sha3;
|
||||
pluginRO.txContent = &tmpContent.txContent;
|
||||
|
||||
if (contractAddress == NULL) {
|
||||
if (dataContext.tokenContext.pluginStatus <= ETH_PLUGIN_RESULT_UNSUCCESSFUL) {
|
||||
PRINTF("Cached plugin call but no plugin available\n");
|
||||
return dataContext.tokenContext.pluginStatus;
|
||||
}
|
||||
alias = dataContext.tokenContext.pluginName;
|
||||
} else {
|
||||
PRINTF("No matching plugin available\n");
|
||||
return 0;
|
||||
if (dataContext.tokenContext.pluginStatus <= ETH_PLUGIN_RESULT_UNSUCCESSFUL) {
|
||||
PRINTF("Cached plugin call but no plugin available\n");
|
||||
return dataContext.tokenContext.pluginStatus;
|
||||
}
|
||||
alias = dataContext.tokenContext.pluginName;
|
||||
|
||||
// Prepare the call
|
||||
|
||||
@@ -240,11 +233,6 @@ eth_plugin_result_t eth_plugin_call(uint8_t *contractAddress, int method, void *
|
||||
PRINTF("parameter result: %d\n", ((ethPluginInitContract_t *) parameter)->result);
|
||||
switch (((ethPluginInitContract_t *) parameter)->result) {
|
||||
case ETH_PLUGIN_RESULT_OK:
|
||||
if (contractAddress != NULL) {
|
||||
strcpy(dataContext.tokenContext.pluginName, alias);
|
||||
}
|
||||
break;
|
||||
case ETH_PLUGIN_RESULT_OK_ALIAS:
|
||||
break;
|
||||
case ETH_PLUGIN_RESULT_ERROR:
|
||||
return ETH_PLUGIN_RESULT_ERROR;
|
||||
|
||||
@@ -25,7 +25,7 @@ void eth_plugin_prepare_query_contract_UI(ethQueryContractUI_t *queryContractUI,
|
||||
eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,
|
||||
ethPluginInitContract_t *init);
|
||||
// NULL for cached address, or base contract address
|
||||
eth_plugin_result_t eth_plugin_call(uint8_t *contractAddress, int method, void *parameter);
|
||||
eth_plugin_result_t eth_plugin_call(int method, void *parameter);
|
||||
int compound_plugin_call(uint8_t *contractAddress, int method, void *parameter);
|
||||
|
||||
void plugin_ui_start(void);
|
||||
|
||||
@@ -23,11 +23,7 @@ void plugin_ui_get_id() {
|
||||
strings.tmp.tmp2,
|
||||
sizeof(strings.tmp.tmp2));
|
||||
// Query the original contract for ID if it's not an internal alias
|
||||
if (!eth_plugin_call((dataContext.tokenContext.pluginName[0] == '-' ||
|
||||
tmpCtx.transactionContext.externalPluginIsSet
|
||||
? NULL
|
||||
: tmpContent.txContent.destination),
|
||||
ETH_PLUGIN_QUERY_CONTRACT_ID,
|
||||
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_ID,
|
||||
(void *) &pluginQueryContractID)) {
|
||||
PRINTF("Plugin query contract ID call failed\n");
|
||||
io_seproxyhal_touch_tx_cancel(NULL);
|
||||
@@ -42,7 +38,7 @@ void plugin_ui_get_item() {
|
||||
sizeof(strings.tmp.tmp),
|
||||
strings.tmp.tmp2,
|
||||
sizeof(strings.tmp.tmp2));
|
||||
if (!eth_plugin_call(NULL, ETH_PLUGIN_QUERY_CONTRACT_UI, (void *) &pluginQueryContractUI)) {
|
||||
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_UI, (void *) &pluginQueryContractUI)) {
|
||||
PRINTF("Plugin query contract UI call failed\n");
|
||||
io_seproxyhal_touch_tx_cancel(NULL);
|
||||
}
|
||||
|
||||
@@ -121,8 +121,7 @@ customStatus_e customProcessor(txContext_t *context) {
|
||||
eth_plugin_prepare_provide_parameter(&pluginProvideParameter,
|
||||
dataContext.tokenContext.data,
|
||||
dataContext.tokenContext.fieldIndex * 32 + 4);
|
||||
if (!eth_plugin_call(NULL,
|
||||
ETH_PLUGIN_PROVIDE_PARAMETER,
|
||||
if (!eth_plugin_call(ETH_PLUGIN_PROVIDE_PARAMETER,
|
||||
(void *) &pluginProvideParameter)) {
|
||||
PRINTF("Plugin parameter call failed\n");
|
||||
return CUSTOM_FAULT;
|
||||
@@ -282,7 +281,7 @@ void finalizeParsing(bool direct) {
|
||||
if (dataContext.tokenContext.pluginStatus >= ETH_PLUGIN_RESULT_SUCCESSFUL) {
|
||||
genericUI = false;
|
||||
eth_plugin_prepare_finalize(&pluginFinalize);
|
||||
if (!eth_plugin_call(NULL, ETH_PLUGIN_FINALIZE, (void *) &pluginFinalize)) {
|
||||
if (!eth_plugin_call(ETH_PLUGIN_FINALIZE, (void *) &pluginFinalize)) {
|
||||
PRINTF("Plugin finalize call failed\n");
|
||||
reportFinalizeError(direct);
|
||||
if (!direct) {
|
||||
@@ -297,7 +296,7 @@ void finalizeParsing(bool direct) {
|
||||
token2 = getKnownToken(pluginFinalize.tokenLookup2);
|
||||
}
|
||||
eth_plugin_prepare_provide_token(&pluginProvideToken, token1, token2);
|
||||
if (!eth_plugin_call(NULL, ETH_PLUGIN_PROVIDE_TOKEN, (void *) &pluginProvideToken)) {
|
||||
if (!eth_plugin_call(ETH_PLUGIN_PROVIDE_TOKEN, (void *) &pluginProvideToken)) {
|
||||
PRINTF("Plugin provide token call failed\n");
|
||||
reportFinalizeError(direct);
|
||||
if (!direct) {
|
||||
|
||||
Reference in New Issue
Block a user