Skip to content

Commit 98ae0b7

Browse files
authored
Merge pull request #7 from Zondax/update-2064
Update 2064
2 parents 0917c3e + 7cc756d commit 98ae0b7

124 files changed

Lines changed: 22923 additions & 26902 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ledger.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v2
23+
with:
24+
submodules: true
2325

2426
- name: Build with Clang Static Analyzer
2527
run: |

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
[submodule "deps/nanosplus-secure-sdk"]
1414
path = deps/nanosplus-secure-sdk
1515
url = https://github.com/LedgerHQ/nanosplus-secure-sdk.git
16+
[submodule "deps/ledger-zxlib"]
17+
path = deps/ledger-zxlib
18+
url = https://github.com/zondax/ledger-zxlib

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Please:
2828
- **Do not use in production**
2929
- **Do not use a Ledger device with funds for development purposes.**
3030
- **Have a separate and marked device that is used ONLY for development and testing**
31-
# Acala 1.2063.x
31+
# Acala 1.2064.x
3232

3333
## System
3434

@@ -154,6 +154,7 @@ Please:
154154
|Disable charge fee pool | | :heavy_check_mark: | | `CurrencyId` currency_id <br/> |
155155
|With fee path | | :heavy_check_mark: | | `VecCurrencyId` fee_swap_path <br/>`Call` call <br/> |
156156
|With fee currency | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Call` call <br/> |
157+
|With fee paid by | | :heavy_check_mark: | | `Call` call <br/>`AccountId` payer_addr <br/>`MultiSignature` payer_sig <br/> |
157158

158159
## Treasury
159160

@@ -468,6 +469,13 @@ Please:
468469
|Disable average price | | | | `CurrencyId` currency_id_a <br/>`CurrencyId` currency_id_b <br/> |
469470
|Update average price interval | | | | `CurrencyId` currency_id_a <br/>`CurrencyId` currency_id_b <br/>`Moment` new_interval <br/> |
470471

472+
## AggregatedDex
473+
474+
| Name | Light | XL | Nesting | Arguments |
475+
| :---------- |:------------:|:--------:|:--------:|:--------|
476+
|Swap with exact supply | | | | `VecSwapPath` paths <br/>`Balance` supply_amount <br/>`Balance` min_target_amount <br/> |
477+
|Update aggregated swap paths | | | | `VecTupleCurrencyIdCurrencyIdOptionVecSwapPath` updates <br/> |
478+
471479
## AuctionManager
472480

473481
| Name | Light | XL | Nesting | Arguments |
@@ -492,6 +500,7 @@ Please:
492500
|Expand position collateral | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Balance` increase_debit_value <br/>`Balance` min_increase_collateral <br/> |
493501
|Shrink position debit | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Balance` decrease_collateral <br/>`Balance` min_decrease_debit_value <br/> |
494502
|Adjust loan by debit value | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Amount` collateral_adjustment <br/>`Amount` debit_value_adjustment <br/> |
503+
|Transfer debit | | :heavy_check_mark: | | `CurrencyId` from_currency <br/>`CurrencyId` to_currency <br/>`Balance` debit_transfer <br/> |
495504

496505
## CdpTreasury
497506

app/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ all: bin/app.elf
4040

4141
include $(BOLOS_SDK)/Makefile.defines
4242

43-
DEFINES += APP_SECRET_MODE_ENABLED
43+
DEFINES += APP_ACCOUNT_MODE_ENABLED
4444

4545
$(info ************ TARGET_NAME = [$(TARGET_NAME)])
4646

@@ -76,13 +76,13 @@ ifneq ($(TARGET_NAME),TARGET_NANOS)
7676
DEFINES += SUBSTRATE_PARSER_FULL
7777
endif
7878
APPNAME = "Acala"
79-
APPPATH = "44'/787'" --path "44'/354'"
79+
APPPATH = "44'/787'" --path "44'/354'"
8080

8181
else ifeq ($(COIN),ACA_XL)
8282
# XL app configuration
8383
DEFINES += APP_STANDARD SUBSTRATE_PARSER_FULL
8484
APPNAME = "Acala XL"
85-
APPPATH = "44'/787'" --path "44'/354'"
85+
APPPATH = "44'/787'" --path "44'/354'"
8686

8787
else
8888
define error_message

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is the `transaction_version` field of `Runtime`
22
APPVERSION_M=1
33
# This is the `spec_version` field of `Runtime`
4-
APPVERSION_N=2063
4+
APPVERSION_N=2064
55
# This is the patch version of this release
66
APPVERSION_P=0

app/src/apdu_handler.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "crypto.h"
3030
#include "coin.h"
3131
#include "zxmacros.h"
32-
#include "secret.h"
3332
#include "app_mode.h"
3433

3534
static bool tx_initialized = false;
@@ -50,8 +49,8 @@ void extractHDPath(uint32_t rx, uint32_t offset) {
5049
THROW(APDU_CODE_DATA_INVALID);
5150
}
5251

53-
#ifdef APP_SECRET_MODE_ENABLED
54-
if (app_mode_secret()) {
52+
#ifdef APP_ACCOUNT_MODE_ENABLED
53+
if (app_mode_account()) {
5554
hdPath[1] = HDPATH_1_RECOVERY;
5655
}
5756
#endif

app/src/crowdloans.c

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*******************************************************************************
2+
* (c) 2018 - 2022 Zondax GmbH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
********************************************************************************/
16+
17+
#include "os.h"
18+
#include "cx.h"
19+
#include "coin.h"
20+
#include "app_main.h"
21+
#include "tx.h"
22+
#include "view.h"
23+
#include "app_mode.h"
24+
#include "zxformat.h"
25+
26+
void account_accept() {
27+
#ifdef APP_ACCOUNT_MODE_ENABLED
28+
app_mode_set_account(!app_mode_account());
29+
view_idle_show(0, NULL);
30+
#endif
31+
}
32+
33+
static const char* RELAY_CHAIN_POLKADOT = "Polkadot";
34+
static const char* RELAY_CHAIN_KUSAMA = "Kusama";
35+
static const char* PARACHAIN = COIN_NAME;
36+
37+
static const char* ACCOUNT_CROWDLOAN = "Crowdloan account.";
38+
static const char* ACCOUNT_LEGACY = "Legacy account.";
39+
40+
static const char *crowdloan_message_00 = "You are about to switch to";
41+
static const char *crowdloan_message_01 = "If you are not sure why you are here, reject or unplug your device immediately.";
42+
static const char *crowdloan_message_02 = "Activating this mode will allow you to sign transactions using";
43+
44+
zxerr_t account_getNumItems(uint8_t *num_items) {
45+
zemu_log_stack("crowdloan_getNumItems");
46+
*num_items = 1;
47+
return zxerr_ok;
48+
}
49+
50+
zxerr_t account_getItem(int8_t displayIdx,
51+
char *outKey, uint16_t outKeyLen,
52+
char *outVal, uint16_t outValLen,
53+
uint8_t pageIdx, uint8_t *pageCount) {
54+
if (displayIdx != 0) {
55+
return zxerr_no_data;
56+
}
57+
58+
snprintf(outKey, outKeyLen, "Warning!");
59+
60+
char* account_str = (char*)PIC(ACCOUNT_CROWDLOAN);
61+
char* chain_str = (char*)PIC(RELAY_CHAIN_POLKADOT);
62+
const uint32_t derivation_path = HDPATH_1_RECOVERY & 0xFFF;
63+
if (derivation_path == 0x1b2) {
64+
chain_str = (char*)PIC(RELAY_CHAIN_KUSAMA);
65+
}
66+
if(app_mode_account()) {
67+
account_str = (char*)PIC(ACCOUNT_LEGACY);
68+
chain_str = (char*)PIC(PARACHAIN);
69+
}
70+
71+
char tmpBuf[250];
72+
snprintf(tmpBuf, sizeof(tmpBuf), "%s %s %s %s, %s keys.",
73+
(char*)PIC(crowdloan_message_00),
74+
account_str,
75+
(char*)PIC(crowdloan_message_01),
76+
(char*)PIC(crowdloan_message_02),
77+
chain_str);
78+
pageString(outVal, outValLen, tmpBuf, pageIdx, pageCount);
79+
return zxerr_ok;
80+
}
81+
82+
zxerr_t account_enabled() {
83+
#ifdef APP_ACCOUNT_MODE_ENABLED
84+
view_review_init(account_getItem, account_getNumItems, account_accept);
85+
view_review_show(0x00);
86+
#endif
87+
return zxerr_ok;
88+
}

app/src/secret.c

Lines changed: 0 additions & 65 deletions
This file was deleted.

app/src/secret.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

app/src/substrate/substrate_coin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ typedef enum {
6161
#define COIN_NAME "Acala"
6262
#define COIN_TICKER "ACA "
6363

64-
#define COIN_SECRET_REQUIRED_CLICKS 10
65-
6664
#define MENU_MAIN_APP_LINE1 "Acala"
6765
#define MENU_MAIN_APP_LINE2 "Ready"
6866
#define MENU_MAIN_APP_LINE2_SECRET "ACA RECOVERY"
6967
#define APPVERSION_LINE1 "Acala"
7068
#define APPVERSION_LINE2 "v" APPVERSION
7169

70+
#define ACCOUNT_DEFAULT "Legacy"
71+
#define ACCOUNT_SECONDARY "Crowdloan"
72+
7273
#ifdef __cplusplus
7374
}
7475
#endif

0 commit comments

Comments
 (0)