Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing data support added. #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ static void handle_supply_and_repay(ethPluginProvideParameter_t *msg, context_t
case _AMOUNT_SUPPLY_REPAY:
copy_parameter(context->amount, msg->parameter, sizeof(context->amount));
break;
default:
PRINTF("Param not supported: %d\n", context->next_param);
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
case _SUPPLY_REPAY_IGNORED:
return;
}
context->next_param++;
}
Expand All @@ -46,10 +44,8 @@ static void handle_withdraw_and_borrow(ethPluginProvideParameter_t *msg, context
case _AMOUNT_WITHDRAW_BORROW:
copy_parameter(context->amount, msg->parameter, sizeof(context->amount));
break;
default:
PRINTF("Param not supported: %d\n", context->next_param);
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
case _WITHDRAW_BORROW_IGNORED:
return;
}
context->next_param++;
}
Expand All @@ -67,10 +63,6 @@ static void handle_claim_rewards(ethPluginProvideParameter_t *msg, context_t *co
break;
case CLAIM_REWARDS_IGNORED:
return;
default:
PRINTF("Param not supported: %d\n", context->next_param);
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
context->next_param++;
}
Expand All @@ -82,10 +74,6 @@ static void handle_claim(ethPluginProvideParameter_t *msg, context_t *context) {
break;
case CLAIM_IGNORED:
return;
default:
PRINTF("Param not supported: %d\n", context->next_param);
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
context->next_param++;
}
Expand Down
2 changes: 2 additions & 0 deletions src/morpho_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ typedef enum {
_POOL_TOKEN_ADDRESS_SUPPLY_REPAY,
_ON_BEHALF,
_AMOUNT_SUPPLY_REPAY,
_SUPPLY_REPAY_IGNORED,
} supply_repay_parameters;

typedef enum {
_POOL_TOKEN_ADDRESS_WITHDRAW_BORROW,
_AMOUNT_WITHDRAW_BORROW,
_WITHDRAW_BORROW_IGNORED,
} withdraw_borrow_parameters;

typedef enum {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { nano_models, processTest, populateTransaction } from "../../../../test.fixture";

const contractName = "Morpho";
const contractAddr = "0x8888882f8f843896699869179fb6e4f7e3b58888";
const testNetwork = "ethereum";

const testLabel = "supply usdt trailing data"; // <= Name of the test
const testDirSuffix = testLabel.toLowerCase().replace(/\s+/g, '_');

const inputData = "0x0c0a769b000000000000000000000000f650c3d88d12db855b8bf7d11be6c55a4e07dcc9000000000000000000000000DAD77910DBDFDE764FC21FCD4E74D71BBACA6D8D0000000000000000000000000000000000000000000000000000000005f56bd00000000000000000000000000000000000000000000000000000018a504d338b00000000000000000000000000000000000000000000000000004c6564676572";

const models = [
{
name: 'nanosp',
steps: 4
},
]

// populate unsignedTx from genericTx and get network chain id
const unsignedTx = populateTransaction(contractAddr, inputData, testNetwork);
// Process tests for each nano models
models.forEach((model) => {
const nano_model = nano_models.find((nano_model) => nano_model.name === model.name)
processTest(nano_model, model.steps, contractName, testLabel, testDirSuffix, unsignedTx, testNetwork)
})