From 11649b37dd2a01f6e40b4c36569e16681f7906d4 Mon Sep 17 00:00:00 2001 From: Gabriel Montes Date: Wed, 2 Nov 2022 21:21:40 -0300 Subject: [PATCH] Rename everything to Vesper --- Makefile | 10 ++++------ README.md | 2 +- ...app_boilerplate.gif => nanos_app_vesper.gif} | Bin ...app_boilerplate.gif => nanox_app_vesper.gif} | Bin src/handle_finalize.c | 2 +- src/handle_init_contract.c | 4 ++-- src/handle_provide_parameter.c | 2 +- src/handle_provide_token.c | 2 +- src/handle_query_contract_id.c | 2 +- src/handle_query_contract_ui.c | 2 +- src/main.c | 9 ++++----- src/{boilerplate_plugin.h => vesper_plugin.h} | 6 ++---- ...a250d5630b4cf539739df2c5dacb4c659f2488d.json | 0 .../ethereum/{boilerplate => vesper}/b2c.json | 4 ++-- .../nanos_swap_exact_eth_for_tokens/00001.png | Bin 345 -> 312 bytes .../00001.png | Bin 345 -> 312 bytes .../nanosp_swap_exact_eth_for_tokens/00001.png | Bin 419 -> 366 bytes .../00001.png | Bin 419 -> 366 bytes .../nanox_swap_exact_eth_for_tokens/00001.png | Bin 419 -> 366 bytes .../00001.png | Bin 419 -> 366 bytes tests/src/generate_plugin_config.js | 3 +-- tests/src/swap_exact_eth_for_tokens.test.js | 3 +-- tests/src/test.fixture.js | 8 +++----- 23 files changed, 25 insertions(+), 34 deletions(-) rename icons/{nanos_app_boilerplate.gif => nanos_app_vesper.gif} (100%) rename icons/{nanox_app_boilerplate.gif => nanox_app_vesper.gif} (100%) rename src/{boilerplate_plugin.h => vesper_plugin.h} (90%) rename tests/networks/ethereum/{boilerplate => vesper}/abis/0x7a250d5630b4cf539739df2c5dacb4c659f2488d.json (100%) rename tests/networks/ethereum/{boilerplate => vesper}/b2c.json (85%) diff --git a/Makefile b/Makefile index e5e345c..6723497 100755 --- a/Makefile +++ b/Makefile @@ -21,8 +21,7 @@ endif include $(BOLOS_SDK)/Makefile.defines -# EDIT THIS: Put your plugin name -APPNAME = "Boilerplate" +APPNAME = "Vesper" ifeq ($(ETHEREUM_PLUGIN_SDK),) ETHEREUM_PLUGIN_SDK=ethereum-plugin-sdk @@ -39,9 +38,9 @@ APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" # EDIT THIS: Change the name of the gif, and generate you own GIFs! ifeq ($(TARGET_NAME), TARGET_NANOS) -ICONNAME=icons/nanos_app_boilerplate.gif +ICONNAME=icons/nanos_app_vesper.gif else -ICONNAME=icons/nanox_app_boilerplate.gif +ICONNAME=icons/nanox_app_vesper.gif endif ################ @@ -163,5 +162,4 @@ include $(BOLOS_SDK)/Makefile.rules dep/%.d: %.c Makefile listvariants: - # EDIT THIS: replace `boilerplate` by the lowercase name of your plugin - @echo VARIANTS NONE boilerplate + @echo VARIANTS NONE vesper diff --git a/README.md b/README.md index c5d4a78..3bba246 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# app-plugin-boilerplate +# app-plugin-vesper This repo contains the Vesper plugin for Ledger Nano S, S Plus and X devices. diff --git a/icons/nanos_app_boilerplate.gif b/icons/nanos_app_vesper.gif similarity index 100% rename from icons/nanos_app_boilerplate.gif rename to icons/nanos_app_vesper.gif diff --git a/icons/nanox_app_boilerplate.gif b/icons/nanox_app_vesper.gif similarity index 100% rename from icons/nanox_app_boilerplate.gif rename to icons/nanox_app_vesper.gif diff --git a/src/handle_finalize.c b/src/handle_finalize.c index f6ba228..3b0e920 100644 --- a/src/handle_finalize.c +++ b/src/handle_finalize.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" void handle_finalize(void *parameters) { ethPluginFinalize_t *msg = (ethPluginFinalize_t *) parameters; diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index d79fff8..13ad41b 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" static int find_selector(uint32_t selector, const uint32_t *selectors, size_t n, selector_t *out) { for (selector_t i = 0; i < n; i++) { @@ -36,7 +36,7 @@ void handle_init_contract(void *parameters) { memset(context, 0, sizeof(*context)); uint32_t selector = U4BE(msg->selector, 0); - if (find_selector(selector, BOILERPLATE_SELECTORS, NUM_SELECTORS, &context->selectorIndex)) { + if (find_selector(selector, VESPER_SELECTORS, NUM_SELECTORS, &context->selectorIndex)) { msg->result = ETH_PLUGIN_RESULT_UNAVAILABLE; return; } diff --git a/src/handle_provide_parameter.c b/src/handle_provide_parameter.c index cdd7009..601dac6 100644 --- a/src/handle_provide_parameter.c +++ b/src/handle_provide_parameter.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" // EDIT THIS: Remove this function and write your own handlers! static void handle_swap_exact_eth_for_tokens(ethPluginProvideParameter_t *msg, context_t *context) { diff --git a/src/handle_provide_token.c b/src/handle_provide_token.c index 9ae94bd..84c4cd4 100644 --- a/src/handle_provide_token.c +++ b/src/handle_provide_token.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" // EDIT THIS: Adapt this function to your needs! Remember, the information for tokens are held in // `msg->token1` and `msg->token2`. If those pointers are `NULL`, this means the ethereum app didn't diff --git a/src/handle_query_contract_id.c b/src/handle_query_contract_id.c index b40c810..f9f165c 100644 --- a/src/handle_query_contract_id.c +++ b/src/handle_query_contract_id.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" // Sets the first screen to display. void handle_query_contract_id(void *parameters) { diff --git a/src/handle_query_contract_ui.c b/src/handle_query_contract_ui.c index 3cc726c..371c45e 100644 --- a/src/handle_query_contract_ui.c +++ b/src/handle_query_contract_ui.c @@ -1,4 +1,4 @@ -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" // EDIT THIS: You need to adapt / remove the static functions (set_send_ui, set_receive_ui ...) to // match what you wish to display. diff --git a/src/main.c b/src/main.c index 8beadea..692c5c6 100644 --- a/src/main.c +++ b/src/main.c @@ -22,17 +22,16 @@ #include "os.h" #include "cx.h" -#include "boilerplate_plugin.h" +#include "vesper_plugin.h" // List of selectors supported by this plugin. // EDIT THIS: Adapt the variable names and change the `0x` values to match your selectors. static const uint32_t SWAP_EXACT_ETH_FOR_TOKENS_SELECTOR = 0x7ff36ab5; static const uint32_t BOILERPLATE_DUMMY_SELECTOR_2 = 0x13374242; -// Array of all the different boilerplate selectors. Make sure this follows the same order as the -// enum defined in `boilerplate_plugin.h` -// EDIT THIS: Use the names of the array declared above. -const uint32_t BOILERPLATE_SELECTORS[NUM_SELECTORS] = { +// Array of all the different Vesper selectors. Make sure this follows the same order as the +// enum defined in `vesper_plugin.h` +const uint32_t VESPER_SELECTORS[NUM_SELECTORS] = { SWAP_EXACT_ETH_FOR_TOKENS_SELECTOR, BOILERPLATE_DUMMY_SELECTOR_2, }; diff --git a/src/boilerplate_plugin.h b/src/vesper_plugin.h similarity index 90% rename from src/boilerplate_plugin.h rename to src/vesper_plugin.h index 45403be..6b96dde 100644 --- a/src/boilerplate_plugin.h +++ b/src/vesper_plugin.h @@ -9,8 +9,7 @@ #define NUM_SELECTORS 2 // Name of the plugin. -// EDIT THIS: Replace with your plugin name. -#define PLUGIN_NAME "Boilerplate" +#define PLUGIN_NAME "Vesper" // Enumeration of the different selectors possible. // Should follow the exact same order as the array declared in main.c @@ -31,8 +30,7 @@ typedef enum { UNEXPECTED_PARAMETER, } parameter; -// EDIT THIS: Rename `BOILERPLATE` to be the same as the one initialized in `main.c`. -extern const uint32_t BOILERPLATE_SELECTORS[NUM_SELECTORS]; +extern const uint32_t VESPER_SELECTORS[NUM_SELECTORS]; // Shared global memory with Ethereum app. Must be at most 5 * 32 bytes. // EDIT THIS: This struct is used by your plugin to save the parameters you parse. You diff --git a/tests/networks/ethereum/boilerplate/abis/0x7a250d5630b4cf539739df2c5dacb4c659f2488d.json b/tests/networks/ethereum/vesper/abis/0x7a250d5630b4cf539739df2c5dacb4c659f2488d.json similarity index 100% rename from tests/networks/ethereum/boilerplate/abis/0x7a250d5630b4cf539739df2c5dacb4c659f2488d.json rename to tests/networks/ethereum/vesper/abis/0x7a250d5630b4cf539739df2c5dacb4c659f2488d.json diff --git a/tests/networks/ethereum/boilerplate/b2c.json b/tests/networks/ethereum/vesper/b2c.json similarity index 85% rename from tests/networks/ethereum/boilerplate/b2c.json rename to tests/networks/ethereum/vesper/b2c.json index 9542655..60e9b70 100644 --- a/tests/networks/ethereum/boilerplate/b2c.json +++ b/tests/networks/ethereum/vesper/b2c.json @@ -10,10 +10,10 @@ "path.1" ], "method": "swapExactETHForTokens", - "plugin": "Boilerplate" + "plugin": "Vesper" } } } ], - "name": "Boilerplate" + "name": "Vesper" } \ No newline at end of file diff --git a/tests/snapshots/nanos_swap_exact_eth_for_tokens/00001.png b/tests/snapshots/nanos_swap_exact_eth_for_tokens/00001.png index e942490db6f873c917b23a634080b6ba1ef9d8b3..e06b6e73aba958f3505ba53834a1ec9df7ac7c50 100644 GIT binary patch delta 286 zcmV+(0pb4H0=NQ@BYyz@NklNDov9Vb(5UhRi!uGzrpR z<3Z*)gb+dq2(GjLMEsXD;x~x?bG3kBVltd>{f$pXW{CpD3TOM(%E5;1IWgzl@BhHN*e=Li<)>71(u3#AVmd)A zEgVdzi4Z~vxrp~`^V54qM%(Mi1{o1!bpDh8AGvw!cNm_rE^=Zk)#OrQji{~1?-ydMMRpeMts z5Ckyiu(4>01=3uQd~FA(6d?;oshyTW_2MY0lZub5AJdshXgIh}fFx*rh_bYiaV$Z5RYf@u@bd%+$f*D&K_kKh5JJd(`2b`kzP|{` R15p3~002ovPDHLkV1mcXkct2R diff --git a/tests/snapshots/nanos_swap_exact_eth_for_tokens_with_beneficiary/00001.png b/tests/snapshots/nanos_swap_exact_eth_for_tokens_with_beneficiary/00001.png index e942490db6f873c917b23a634080b6ba1ef9d8b3..e06b6e73aba958f3505ba53834a1ec9df7ac7c50 100644 GIT binary patch delta 286 zcmV+(0pb4H0=NQ@BYyz@NklNDov9Vb(5UhRi!uGzrpR z<3Z*)gb+dq2(GjLMEsXD;x~x?bG3kBVltd>{f$pXW{CpD3TOM(%E5;1IWgzl@BhHN*e=Li<)>71(u3#AVmd)A zEgVdzi4Z~vxrp~`^V54qM%(Mi1{o1!bpDh8AGvw!cNm_rE^=Zk)#OrQji{~1?-ydMMRpeMts z5Ckyiu(4>01=3uQd~FA(6d?;oshyTW_2MY0lZub5AJdshXgIh}fFx*rh_bYiaV$Z5RYf@u@bd%+$f*D&K_kKh5JJd(`2b`kzP|{` R15p3~002ovPDHLkV1mcXkct2R diff --git a/tests/snapshots/nanosp_swap_exact_eth_for_tokens/00001.png b/tests/snapshots/nanosp_swap_exact_eth_for_tokens/00001.png index f1d1ae629289f7d396a9e23b659f909db7f3a948..e69f8c969405a709f286bcc5d25c42d1e1084c3f 100644 GIT binary patch delta 339 zcmV-Z0j&O`1MUKlB!4wYL_t(|obA|M4#FT1Mo~2Gg#9mxz4$;vkfHoE8b0Kn2h-Lz z83vdZoC5#=0FD(x2qD3j+@`(|8?PRF?ZGAL9gvH)K4v*T-db6LbXqn0 z4cd4gh_uLc(@eW>CADPRav7Lx#P=vSrxKfTxc7*+=!ia$bxIY|)JZaZ@KdB000000 l00000000000002^nK$Pl&y0&%k{kd4002ovPDHLkV1n>Zn*{&> delta 393 zcmV;40e1fG0;29PO-008d(9O}q9%iWZcU9uFA+b63&d68Rv+-mBHLQ2UwSUKnB{&4pHVBNLn zHR#3-E5lT$NJ^=mvOCXKub}JI#ct&{1DfD&_1QjmHE@y5eRHtamV8BlIg zdD}|m`09y9xR>pS>kD=cb5F?&J(+?=ok<8o6VCHF>QL8ur20C+Et)zHKAViEkz_)dAiG)ob3ZAWh#E1e4y z=otOOs_g1dU4N$eD)MBCI|GK+Dk6v27X61AWPpwTsae6iS z4r)9Pg7j$F4ez{}R14de&4z_-@iCFRv(mQ6%{?Y~k6tkbVZ9{_#k3P-#^6?j7XSbN n000000000000000xXl+2R0;V+j&+^@00003j+@`(|8?PRF?ZGAL9gvH)K4v*T-db6LbXqn0 z4cd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