update plugin sdk

This commit is contained in:
pscott
2021-07-27 12:11:56 +02:00
11 changed files with 56 additions and 18 deletions

View File

@@ -5,21 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.8.8](https://github.com/ledgerhq/app-ethereum/compare/1.7.9...1.8.6) - 2021-7-21
### Added
- Added support for BSC.
- Add support for Lido plugin
## [1.8.7](https://github.com/ledgerhq/app-ethereum/compare/1.8.6...1.8.7) - 2021-7-9
### Added
Plugins can now check the address of the transaction sender.
Remove `m/44'/60'` derivation path authorisation for Theta app.
### Fixed
`additional_screens` was introduced previously but wasn't properly initialized in some cases.
## [1.8.6](https://github.com/ledgerhq/app-ethereum/compare/1.8.5...1.8.6) - 2021-7-5
### Added
Display the name of the network when signing a transaction, or the chain ID if the network is not known
When the network is known, amounts and fees are displayed in the network unit instead of ETH.
### Fixed
Fix some compilation warning
@@ -28,39 +38,39 @@ Fix some compilation warning
### Added
Added support for external plugins.
- Added support for external plugins.
## [1.7.9](https://github.com/ledgerhq/app-ethereum/compare/1.7.8...1.7.9) - 2021-6-2
### Added
Added support for Flare Network and Theta Chain.
- Added support for Flare Network and Theta Chain.
## [1.7.8](https://github.com/ledgerhq/app-ethereum/compare/1.7.7...1.7.8) - 2021-5-20
### Fixed
Fixed a bug where transaction would sometimes not get properly signed.
- Fixed a bug where transaction would sometimes not get properly signed.
## [1.7.7](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.7) - 2021-5-19
### Special
Version bump needed for deployment reasons, nothing changed.
- Version bump needed for deployment reasons, nothing changed.
## [1.7.6](https://github.com/ledgerhq/app-ethereum/compare/1.7.5...1.7.6) - 2021-5-14
### Special
Version bump needed for deployment reasons, nothing changed.
- Version bump needed for deployment reasons, nothing changed.
## [1.7.7](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.7) - 2021-5-19
N/A
- N/A
## [1.7.6](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.6) - 2021-5-14
N/A
- N/A
## [1.7.5](https://github.com/ledgerhq/app-ethereum/compare/1.7.4...1.7.5) - 2021-5-10
@@ -85,9 +95,9 @@ N/A
### Added
- Improve Ethereum 2 deposit security:
- Display the validator address on screen when depositing.
- Abort signing when the account index of the withdrawal key is higher than INDEX_MAX.
- Check that the destination field of the transaction is Ethereum 2 deposit contract.
- Display the validator address on screen when depositing.
- Abort signing when the account index of the withdrawal key is higher than INDEX_MAX.
- Check that the destination field of the transaction is Ethereum 2 deposit contract.
## [1.7.1](https://github.com/ledgerhq/app-ethereum/compare/1.7.0...1.7.1) - 2021-5-5
@@ -95,21 +105,25 @@ N/A
- Support for Berlin hard fork: EIP2718 (transaction types) and EIP2930 (access list transactions)
- Display ChainID when transacting on chains which are not ethereum (BSC, Polygon, etc)
## [1.7.0](https://github.com/ledgerhq/app-ethereum/compare/1.6.6...1.7.0) - 2021-4-30
### Added
- Wallet ID feature now available on Nano X
## [1.6.6](https://github.com/ledgerhq/app-ethereum/compare/1.6.5...1.6.6) - 2021-4-16
### Added
- Improved Starkware support
## [1.6.5](https://github.com/ledgerhq/app-ethereum/compare/1.6.4...1.6.5) - 2021-2-12
### Added
- Add a setting to enable nonce display when approving transactions
## [1.6.4](https://github.com/ledgerhq/app-ethereum/compare/1.6.3...1.6.4) - 2021-1-12
### Fixed

View File

@@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'"
APPVERSION_M=1
APPVERSION_N=8
APPVERSION_P=7
APPVERSION_P=8
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)
APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION)
@@ -200,6 +200,10 @@ else ifeq ($(CHAIN),theta)
APP_LOAD_PARAMS += --path "44'/500'"
DEFINES += CHAINID_UPCASE=\"THETA\" CHAINID_COINNAME=\"THETA\" CHAIN_KIND=CHAIN_KIND_THETA CHAIN_ID=500
APPNAME = "Theta"
else ifeq ($(CHAIN),bsc)
APP_LOAD_PARAMS += --path "44'/60'"
DEFINES += CHAINID_UPCASE=\"BSC\" CHAINID_COINNAME=\"BNB\" CHAIN_KIND=CHAIN_KIND_BSC CHAIN_ID=56
APPNAME = "Binance Smart Chain"
else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported CHAIN - use ethereum, ropsten, ethereum_classic, expanse, poa, artis_sigma1, artis_tau1, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain, tobalaba, dexon, volta, ewc, webchain, thundercore, flare, flare_coston, theta)
@@ -340,6 +344,7 @@ endif
# rebuild
$(shell python3 ethereum-plugin-sdk/build_sdk.py)
$(shell find ./ethereum-plugin-sdk -iname '*.h' -o -iname '*.c' | xargs clang-format-10 -i)
# check if a difference is noticed (fail if it happens in CI build)
ifneq ($(shell git status | grep 'ethereum-plugin-sdk'),)
@@ -372,4 +377,4 @@ include $(BOLOS_SDK)/Makefile.rules
dep/%.d: %.c Makefile
listvariants:
@echo VARIANTS CHAIN ethereum ropsten ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore flare flare_coston theta
@echo VARIANTS CHAIN ethereum ropsten ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore flare flare_coston theta bsc

BIN
icons/nanos_app_bsc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

BIN
icons/nanox_app_bsc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@@ -54,7 +54,8 @@ typedef enum chain_kind_e {
CHAIN_KIND_WEBCHAIN,
CHAIN_KIND_THUNDERCORE,
CHAIN_KIND_FLARE,
CHAIN_KIND_THETA
CHAIN_KIND_THETA,
CHAIN_KIND_BSC
} chain_kind_t;
typedef struct chain_config_s {

View File

@@ -254,6 +254,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) {
case CHAIN_KIND_THETA:
numTokens = NUM_TOKENS_THETA;
break;
case CHAIN_KIND_BSC:
numTokens = NUM_TOKENS_BSC;
break;
}
for (i = 0; i < numTokens; i++) {
switch (chainConfig->kind) {
@@ -352,6 +355,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) {
break case CHAIN_KIND_THETA : currentToken =
(tokenDefinition_t *) PIC(&TOKENS_THETA[i]);
break;
case CHAIN_KIND_BSC:
currentToken = (tokenDefinition_t *) PIC(&TOKENS_BSC[i]);
break;
}
if (memcmp(currentToken->address, tmpContent.txContent.destination, ADDRESS_LENGTH) == 0) {
return currentToken;

View File

@@ -4566,4 +4566,6 @@ const tokenDefinition_t const TOKENS_FLARE[NUM_TOKENS_FLARE] = {};
const tokenDefinition_t const TOKENS_THETA[NUM_TOKENS_THETA] = {};
const tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC] = {};
#endif

View File

@@ -96,6 +96,7 @@ static const uint8_t LEDGER_SIGNATURE_PUBLIC_KEY[] = {
#define NUM_TOKENS_THUNDERCORE 0
#define NUM_TOKENS_FLARE 0
#define NUM_TOKENS_THETA 0
#define NUM_TOKENS_BSC 0
extern tokenDefinition_t const TOKENS_AKROMA[NUM_TOKENS_AKROMA];
extern tokenDefinition_t const TOKENS_ELLAISM[NUM_TOKENS_ELLAISM];
@@ -129,6 +130,7 @@ extern tokenDefinition_t const TOKENS_WEBCHAIN[NUM_TOKENS_WEBCHAIN];
extern tokenDefinition_t const TOKENS_THUNDERCORE[NUM_TOKENS_THUNDERCORE];
extern tokenDefinition_t const TOKENS_FLARE[NUM_TOKENS_FLARE];
extern tokenDefinition_t const TOKENS_THETA[NUM_TOKENS_THETA];
extern tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC];
#endif /* HAVE_TOKENS_LIST */

View File

@@ -145,8 +145,8 @@ void handleProvideErc20TokenInformation(uint8_t p1,
offset += 4;
dataLength -= 4;
chainId = U4BE(workBuffer, offset);
if ((chainConfig->chainId != 0) && (chainConfig->chainId != chainId)) {
PRINTF("ChainId token mismatch\n");
if ((chainConfig->chainId != ETHEREUM_MAINNET_CHAINID) && (chainConfig->chainId != chainId)) {
PRINTF("ChainId token mismatch: %d vs %d\n", chainConfig->chainId, chainId);
THROW(0x6A80);
}
offset += 4;

View File

@@ -27,7 +27,7 @@ typedef struct contract_t {
uint8_t address[ADDRESS_LENGTH];
} contract_t;
#define NUM_CONTRACTS 11
#define NUM_CONTRACTS 13
const contract_t CONTRACTS[NUM_CONTRACTS] = {
// Compound
{"Compound DAI", {0x5d, 0x3a, 0x53, 0x6e, 0x4d, 0x6d, 0xbd, 0x61, 0x14, 0xcc,
@@ -52,7 +52,15 @@ const contract_t CONTRACTS[NUM_CONTRACTS] = {
0x48, 0x73, 0xd0, 0x0f, 0xf8, 0x5b, 0xcc, 0xde, 0xd5, 0x50}},
// Paraswap
{"Paraswap", {0x1b, 0xd4, 0x35, 0xf3, 0xc0, 0x54, 0xb6, 0xe9, 0x01, 0xb7,
0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}}};
0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}},
// stETH
{"Lido", {0x7f, 0x39, 0xc5, 0x81, 0xf5, 0x95, 0xb5, 0x3c, 0x5c, 0xb1,
0x9b, 0xd0, 0xb3, 0xf8, 0xda, 0x6c, 0x93, 0x5e, 0x2c, 0xa0}},
// wstETH
{"Wrapped stETH", {0xae, 0x7a, 0xb9, 0x65, 0x20, 0xde, 0x3a, 0x18, 0xe5, 0xe1,
0x11, 0xb5, 0xea, 0xab, 0x09, 0x53, 0x12, 0xd7, 0xfe, 0x84}}};
bool check_contract(erc20_parameters_t *context) {
for (size_t i = 0; i < NUM_CONTRACTS; i++) {