Skip to content

Commit 0917c3e

Browse files
authored
Merge pull request #6 from Zondax/update-2063
Update 2063
2 parents 03086fe + fc86e95 commit 0917c3e

26 files changed

Lines changed: 17453 additions & 16698 deletions

README.md

Lines changed: 2 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.2061.x
31+
# Acala 1.2063.x
3232

3333
## System
3434

@@ -491,6 +491,7 @@ Please:
491491
|Unauthorize all | | :heavy_check_mark: | | |
492492
|Expand position collateral | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Balance` increase_debit_value <br/>`Balance` min_increase_collateral <br/> |
493493
|Shrink position debit | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Balance` decrease_collateral <br/>`Balance` min_decrease_debit_value <br/> |
494+
|Adjust loan by debit value | | :heavy_check_mark: | | `CurrencyId` currency_id <br/>`Amount` collateral_adjustment <br/>`Amount` debit_value_adjustment <br/> |
494495

495496
## CdpTreasury
496497

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=2061
4+
APPVERSION_N=2063
55
# This is the patch version of this release
66
APPVERSION_P=0

app/src/apdu_handler.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ __Z_INLINE void handleGetAddr(volatile uint32_t *flags, volatile uint32_t *tx, u
144144
}
145145
if (requireConfirmation) {
146146
view_review_init(addr_getItem, addr_getNumItems, app_reply_address);
147-
view_review_show();
147+
view_review_show(0x03);
148148
*flags |= IO_ASYNCH_REPLY;
149149
return;
150150
}
@@ -173,7 +173,7 @@ __Z_INLINE void handleSignSr25519(volatile uint32_t *flags, volatile uint32_t *t
173173
}
174174

175175
view_review_init(tx_getItem, tx_getNumItems, app_return_sr25519);
176-
view_review_show();
176+
view_review_show(0x03);
177177
*flags |= IO_ASYNCH_REPLY;
178178
}
179179
#endif
@@ -189,7 +189,7 @@ __Z_INLINE void handleSignEd25519(volatile uint32_t *flags, volatile uint32_t *t
189189
}
190190

191191
view_review_init(tx_getItem, tx_getNumItems, app_sign_ed25519);
192-
view_review_show();
192+
view_review_show(0x03);
193193
*flags |= IO_ASYNCH_REPLY;
194194
}
195195

app/src/secret.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ zxerr_t secret_enabled() {
5959
#ifdef APP_SECRET_MODE_ENABLED
6060
zemu_log("RECOVERY TRIGGERED");
6161
view_review_init(secret_getItem, secret_getNumItems, secret_accept);
62-
view_review_show();
62+
view_review_show(0x00);
6363
#endif
6464
return zxerr_ok;
6565
}

app/src/substrate/substrate_dispatch_V1.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,15 @@ __Z_INLINE parser_error_t _readMethod_honzon_shrink_position_debit_V1(
828828
return parser_ok;
829829
}
830830

831+
__Z_INLINE parser_error_t _readMethod_honzon_adjust_loan_by_debit_value_V1(
832+
parser_context_t* c, pd_honzon_adjust_loan_by_debit_value_V1_t* m)
833+
{
834+
CHECK_ERROR(_readCurrencyId_V1(c, &m->currency_id))
835+
CHECK_ERROR(_readAmount_V1(c, &m->collateral_adjustment))
836+
CHECK_ERROR(_readAmount_V1(c, &m->debit_value_adjustment))
837+
return parser_ok;
838+
}
839+
831840
__Z_INLINE parser_error_t _readMethod_homa_mint_V1(
832841
parser_context_t* c, pd_homa_mint_V1_t* m)
833842
{
@@ -1390,6 +1399,9 @@ parser_error_t _readMethod_V1(
13901399
case 26119: /* module 102 call 7 */
13911400
CHECK_ERROR(_readMethod_honzon_shrink_position_debit_V1(c, &method->basic.honzon_shrink_position_debit_V1))
13921401
break;
1402+
case 26120: /* module 102 call 8 */
1403+
CHECK_ERROR(_readMethod_honzon_adjust_loan_by_debit_value_V1(c, &method->basic.honzon_adjust_loan_by_debit_value_V1))
1404+
break;
13931405
case 29696: /* module 116 call 0 */
13941406
CHECK_ERROR(_readMethod_homa_mint_V1(c, &method->basic.homa_mint_V1))
13951407
break;
@@ -1764,6 +1776,8 @@ const char* _getMethod_Name_V1_ParserFull(uint16_t callPrivIdx)
17641776
return STR_ME_EXPAND_POSITION_COLLATERAL;
17651777
case 26119: /* module 102 call 7 */
17661778
return STR_ME_SHRINK_POSITION_DEBIT;
1779+
case 26120: /* module 102 call 8 */
1780+
return STR_ME_ADJUST_LOAN_BY_DEBIT_VALUE;
17671781
case 29696: /* module 116 call 0 */
17681782
return STR_ME_MINT;
17691783
case 29697: /* module 116 call 1 */
@@ -2040,6 +2054,8 @@ uint8_t _getMethod_NumItems_V1(uint8_t moduleIdx, uint8_t callIdx)
20402054
return 3;
20412055
case 26119: /* module 102 call 7 */
20422056
return 3;
2057+
case 26120: /* module 102 call 8 */
2058+
return 3;
20432059
case 29696: /* module 116 call 0 */
20442060
return 1;
20452061
case 29697: /* module 116 call 1 */
@@ -3014,6 +3030,17 @@ const char* _getMethod_ItemName_V1(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
30143030
default:
30153031
return NULL;
30163032
}
3033+
case 26120: /* module 102 call 8 */
3034+
switch (itemIdx) {
3035+
case 0:
3036+
return STR_IT_currency_id;
3037+
case 1:
3038+
return STR_IT_collateral_adjustment;
3039+
case 2:
3040+
return STR_IT_debit_value_adjustment;
3041+
default:
3042+
return NULL;
3043+
}
30173044
case 29696: /* module 116 call 0 */
30183045
switch (itemIdx) {
30193046
case 0:
@@ -4803,6 +4830,26 @@ parser_error_t _getMethod_ItemValue_V1(
48034830
default:
48044831
return parser_no_data;
48054832
}
4833+
case 26120: /* module 102 call 8 */
4834+
switch (itemIdx) {
4835+
case 0: /* honzon_adjust_loan_by_debit_value_V1 - currency_id */;
4836+
return _toStringCurrencyId_V1(
4837+
&m->basic.honzon_adjust_loan_by_debit_value_V1.currency_id,
4838+
outValue, outValueLen,
4839+
pageIdx, pageCount);
4840+
case 1: /* honzon_adjust_loan_by_debit_value_V1 - collateral_adjustment */;
4841+
return _toStringAmount_V1(
4842+
&m->basic.honzon_adjust_loan_by_debit_value_V1.collateral_adjustment,
4843+
outValue, outValueLen,
4844+
pageIdx, pageCount);
4845+
case 2: /* honzon_adjust_loan_by_debit_value_V1 - debit_value_adjustment */;
4846+
return _toStringAmount_V1(
4847+
&m->basic.honzon_adjust_loan_by_debit_value_V1.debit_value_adjustment,
4848+
outValue, outValueLen,
4849+
pageIdx, pageCount);
4850+
default:
4851+
return parser_no_data;
4852+
}
48064853
case 29696: /* module 116 call 0 */
48074854
switch (itemIdx) {
48084855
case 0: /* homa_mint_V1 - amount */;
@@ -5397,6 +5444,7 @@ bool _getMethod_IsNestingSupported_V1(uint8_t moduleIdx, uint8_t callIdx)
53975444
case 26117: // Honzon:Unauthorize all
53985445
case 26118: // Honzon:Expand position collateral
53995446
case 26119: // Honzon:Shrink position debit
5447+
case 26120: // Honzon:Adjust loan by debit value
54005448
case 29696: // Homa:Mint
54015449
case 29697: // Homa:Request redeem
54025450
case 29698: // Homa:Fast match redeems

app/src/substrate/substrate_methods_V1.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,13 @@ typedef struct {
545545
pd_Balance_t min_decrease_debit_value;
546546
} pd_honzon_shrink_position_debit_V1_t;
547547

548+
#define PD_CALL_HONZON_ADJUST_LOAN_BY_DEBIT_VALUE_V1 8
549+
typedef struct {
550+
pd_CurrencyId_V1_t currency_id;
551+
pd_Amount_V1_t collateral_adjustment;
552+
pd_Amount_V1_t debit_value_adjustment;
553+
} pd_honzon_adjust_loan_by_debit_value_V1_t;
554+
548555
#define PD_CALL_HOMA_MINT_V1 0
549556
typedef struct {
550557
pd_Compactu128_t amount;
@@ -818,6 +825,7 @@ typedef union {
818825
pd_honzon_unauthorize_all_V1_t honzon_unauthorize_all_V1;
819826
pd_honzon_expand_position_collateral_V1_t honzon_expand_position_collateral_V1;
820827
pd_honzon_shrink_position_debit_V1_t honzon_shrink_position_debit_V1;
828+
pd_honzon_adjust_loan_by_debit_value_V1_t honzon_adjust_loan_by_debit_value_V1;
821829
pd_homa_mint_V1_t homa_mint_V1;
822830
pd_homa_request_redeem_V1_t homa_request_redeem_V1;
823831
pd_homa_fast_match_redeems_V1_t homa_fast_match_redeems_V1;

app/src/substrate/substrate_strings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static const char* STR_ME_UNAUTHORIZE = "Unauthorize";
144144
static const char* STR_ME_UNAUTHORIZE_ALL = "Unauthorize all";
145145
static const char* STR_ME_EXPAND_POSITION_COLLATERAL = "Expand position collateral";
146146
static const char* STR_ME_SHRINK_POSITION_DEBIT = "Shrink position debit";
147+
static const char* STR_ME_ADJUST_LOAN_BY_DEBIT_VALUE = "Adjust loan by debit value";
147148
static const char* STR_ME_MINT = "Mint";
148149
static const char* STR_ME_REQUEST_REDEEM = "Request redeem";
149150
static const char* STR_ME_FAST_MATCH_REDEEMS = "Fast match redeems";
@@ -271,6 +272,7 @@ static const char* STR_IT_increase_debit_value = "Increase debit value";
271272
static const char* STR_IT_min_increase_collateral = "Min increase collateral";
272273
static const char* STR_IT_decrease_collateral = "Decrease collateral";
273274
static const char* STR_IT_min_decrease_debit_value = "Min decrease debit value";
275+
static const char* STR_IT_debit_value_adjustment = "Debit value adjustment";
274276
static const char* STR_IT_allow_fast_match = "Allow fast match";
275277
static const char* STR_IT_redeemer_list = "Redeemer list";
276278
static const char* STR_IT_redeemer = "Redeemer";

deps/ledger-zxlib/app/common/view.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ void h_approve(__Z_UNUSED unsigned int _) {
4747
}
4848
}
4949

50-
void h_reject(__Z_UNUSED unsigned int _) {
50+
void h_reject(unsigned int requireReply) {
5151
zemu_log_stack("h_reject");
5252

5353
view_idle_show(0, NULL);
5454
UX_WAIT();
55-
app_reject();
55+
if(requireReply > 0) {
56+
app_reject();
57+
}
5658
}
5759

5860
void h_error_accept(__Z_UNUSED unsigned int _) {
@@ -162,7 +164,7 @@ bool is_reject_item(){
162164
}
163165
#endif
164166

165-
void h_review_action() {
167+
void h_review_action(unsigned int requireReply) {
166168
#ifdef INCLUDE_ACTIONS_AS_ITEMS
167169
if( is_accept_item() ){
168170
zemu_log_stack("action_accept");
@@ -172,7 +174,7 @@ void h_review_action() {
172174

173175
if( is_reject_item() ){
174176
zemu_log_stack("action_reject");
175-
h_reject(1);
177+
h_reject(requireReply);
176178
return;
177179
}
178180

@@ -311,8 +313,9 @@ void view_review_init(viewfunc_getItem_t viewfuncGetItem,
311313
viewdata.viewfuncAccept = viewfuncAccept;
312314
}
313315

314-
void view_review_show() {
315-
view_review_show_impl();
316+
void view_review_show(unsigned int requireReply) {
317+
// Set > 0 to reply apdu message
318+
view_review_show_impl(requireReply);
316319
}
317320

318321
void view_error_show() {

deps/ledger-zxlib/app/common/view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ void view_review_init(viewfunc_getItem_t viewfuncGetItem,
5959
viewfunc_getNumItems_t viewfuncGetNumItems,
6060
viewfunc_accept_t viewfuncAccept);
6161

62-
void view_review_show();
62+
void view_review_show(unsigned int requireReply);

deps/ledger-zxlib/app/common/view_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ bool h_paging_can_decrease();
120120

121121
void h_paging_decrease();
122122

123-
void view_review_show_impl();
123+
void view_review_show_impl(unsigned int requireReply);
124124

125125
void h_approve(unsigned int _);
126126

127-
void h_reject(unsigned int _);
127+
void h_reject(unsigned int requireReply);
128128

129-
void h_review_action();
129+
void h_review_action(unsigned int requireReply);
130130

131131
void h_review_update();
132132

0 commit comments

Comments
 (0)