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

W5R1 #26

Closed
wants to merge 68 commits into from
Closed

W5R1 #26

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
92471dd
Some improvements and changes to the contract
Skydev0h Jun 14, 2024
7d1d144
Plugins now bound to same workchain as the wallet, no packing (6)
Skydev0h Jun 14, 2024
1f9b0a3
Moved signature_auth_disable to separate variable from seq_no sign (3)
Skydev0h Jun 14, 2024
a210caa
Fix `getExtensionsArray()` method when address hash starts with `00`
Skydev0h Jun 14, 2024
ba7e312
add builds to git
rise1507 Jun 21, 2024
1d44704
cosmetic: rename constants (no changes in compiled code)
rise1507 Jun 21, 2024
99493bc
cosmetic: types (no changes in compiled code)
rise1507 Jun 21, 2024
0d5cc02
cosmetic: rename vars, avoid abbreviations (no changes in compiled code)
rise1507 Jun 21, 2024
ce56813
cosmetic: remove comments about optimizations (no changes in compiled…
rise1507 Jun 21, 2024
b58bbb9
cosmetic: add additional consts for sizes (no changes in compiled code)
rise1507 Jun 21, 2024
f1f4cb4
cosmetic: add error const (no changes in compiled code)
rise1507 Jun 21, 2024
0537f52
cosmetic: subwallet_id->wallet_id in comments (no changes in compiled…
rise1507 Jun 21, 2024
0574f37
don't store workchain in extensions dict values
rise1507 Jun 21, 2024
2f20a49
remove unnecessary micro-optimiazations
rise1507 Jun 21, 2024
edef797
simplify
rise1507 Jun 21, 2024
4f77395
refactor signature_allowed
rise1507 Jun 21, 2024
9869fef
preload_dict
rise1507 Jun 21, 2024
5a21842
get-methods cosmetic
rise1507 Jun 21, 2024
ad1d90b
simplify
rise1507 Jun 21, 2024
2e31a01
simplify
rise1507 Jun 21, 2024
5424092
c5 comments
rise1507 Jun 21, 2024
b3d712d
fix size check
rise1507 Jun 21, 2024
520dec7
fix error naming
rise1507 Jun 21, 2024
243d7d2
simplify
rise1507 Jun 21, 2024
a39b7b0
simplify
rise1507 Jun 21, 2024
fe128dd
cosmetic-optimization
rise1507 Jun 21, 2024
ab0233d
explicit () in binary operations
rise1507 Jun 22, 2024
477bf6d
cosmetic
rise1507 Jun 22, 2024
029e60a
fix return
rise1507 Jun 22, 2024
5910896
simplify
rise1507 Jun 22, 2024
2ba7fda
commit only for external
rise1507 Jun 22, 2024
c10105a
xctos comment
rise1507 Jun 22, 2024
1f3c177
update stdlib from stablecoin-contract
rise1507 Jun 22, 2024
464e68d
rename get_is_signature_auth_allowed -> is_signature_allowed
rise1507 Jun 22, 2024
d5ea381
comments
rise1507 Jun 24, 2024
816e446
add query_id to extension request so that the extension can recognise…
rise1507 Jun 24, 2024
43fabdf
action prefix 8bit
rise1507 Jun 25, 2024
68a0866
wallet_id 32bit
rise1507 Jun 25, 2024
21f229a
change refs in message (tests not synced yet)
rise1507 Jun 25, 2024
0a40931
only extension can change signature mode (tests not synced yet)
rise1507 Jun 25, 2024
3d822d9
allow work with (~ is_signature_allowed) and empty extensions
rise1507 Jun 25, 2024
c5dc057
refactor errors - only only_extension_can_change_signature_mode numbe…
rise1507 Jun 26, 2024
c678610
refactor errors naming
rise1507 Jun 26, 2024
aff9c49
refactor errors
rise1507 Jun 26, 2024
e4b8c5b
cosmetic (bytecode not changed)
rise1507 Jun 26, 2024
dd9ff28
cosmetic comment (bytecode not changed)
rise1507 Jun 26, 2024
b7b8fd8
simplify
rise1507 Jun 26, 2024
3dc030e
fix mistake
rise1507 Jun 26, 2024
e6ef9e4
receive tons
rise1507 Jun 26, 2024
39d0feb
get_wallet_id -> get_subwallet_id, same with v4
rise1507 Jun 26, 2024
444ddde
return_unless not work
rise1507 Jun 26, 2024
3bd769e
update wrappers and tests
rise1507 Jun 26, 2024
38f7e3a
fix typo
rise1507 Jun 27, 2024
64cff84
change error codes to avoid collision with tvm-exit-codes
rise1507 Jun 28, 2024
6e81ad3
remove return_if, return_unless because its dangerous
rise1507 Jun 28, 2024
facbfcf
additional checks for c5
rise1507 Jul 1, 2024
84eaf15
fix numbers
rise1507 Jul 1, 2024
ee52524
Upgrade packages
Jul 2, 2024
047852a
Migrate to @ton packages
Jul 2, 2024
982f304
Minor fix
Jul 2, 2024
ff8cd74
Extra moar utils for the utils god
Jul 2, 2024
d349886
Test wrapper and constants
Jul 2, 2024
57e37aa
W5 wallet tests
Jul 2, 2024
e805cde
Merge pull request #1 from Trinketer22/w5_tests
tolya-yanot Jul 3, 2024
6220bd6
rebuild
rise1507 Jul 3, 2024
2f962c3
optimize bounced check
rise1507 Jul 3, 2024
b66b103
more accurate check
rise1507 Jul 3, 2024
62bfd99
delete unused code
rise1507 Jul 3, 2024
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
temp
build
.idea
.env
2 changes: 1 addition & 1 deletion Specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ actions$_ {m:#} {n:#} actions:(ActionList n m) = InnerRequest;
Contract state:
```tl-b
wallet_id$_ global_id:# wc:int8 version:(## 8) subwallet_number:# = WalletID;
contract_state$_ seqno:int33 wallet_id:WalletID public_key:(## 256) extensions_dict:(HashmapE 256 int8) = ContractState;
contract_state$_ signature_auth_disabled:(## 1) seqno:# wallet_id:WalletID public_key:(## 256) extensions_dict:(HashmapE 256 int8) = ContractState;
```

## Source code
Expand Down
1 change: 1 addition & 0 deletions build/library-deployer.compiled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"hex":"b5ee9c72410106010030000114ff00f4a413f4bcf2c80b0102012003020006f2f0010202d1050400193b511cbec1b232483ec13b552000053c00601cfc59c2"}
1 change: 1 addition & 0 deletions build/wallet_v5.compiled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"hash":"8b59a99853b0a3c983a6a4a3a695805892813736027e7a765bf6ce5b17b0b0d7","hashBase64":"i1mpmFOwo8mDpqSjppWAWJKBNzYCfnp2W/bOWxewsNc=","hex":"b5ee9c7241021401000282000114ff00f4a413f4bcf2c80b01020120020d020148030402ded020d749c120915b8f6420d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e07070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e012020d70b1f82107369676ebaf2e08a7f700f01e48eefeda2edfb228308d722038308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ddf9109a29945f0bdb31e1f2c087df02b35007b0f2d0845125baf2e0855037baf2e086f823bbf2d0882392f800de01a47fc8ca00cb1f01cf16c9ed542192f80fdedb3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd09084a9e7"}
41 changes: 26 additions & 15 deletions contracts/imports/stdlib.fc
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
;; Standard library for funC
;;

{-
This file is part of TON FunC Standard Library.

FunC Standard Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

FunC Standard Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

-}

{-
# Tuple manipulation primitives
The names and the types are mostly self-explaining.
Expand All @@ -26,7 +41,7 @@ forall X -> tuple cons(X head, tuple tail) asm "CONS";
forall X -> (X, tuple) uncons(tuple list) asm "UNCONS";

;;; Extracts the tail and the head of lisp-style list.
forall X -> (tuple, X) list_next(tuple list) asm( -> 1 0) "UNCONS";
forall X -> (tuple, X) list_next(tuple list) asm(-> 1 0) "UNCONS";

;;; Returns the head of lisp-style list.
forall X -> X car(tuple list) asm "CAR";
Expand Down Expand Up @@ -244,11 +259,9 @@ cont bless(slice s) impure asm "BLESS";
() commit() impure asm "COMMIT";

;;; Not implemented
;;() buy_gas(int gram) impure asm "BUYGAS";

;;; Computes the amount of gas that can be bought for `amount` nanoTONs,
;;; and sets `gl` accordingly in the same way as [set_gas_limit].
() buy_gas(int amount) impure asm "BUYGAS";
;;() buy_gas(int amount) impure asm "BUYGAS";

;;; Computes the minimum of two integers [x] and [y].
int min(int x, int y) asm "MIN";
Expand Down Expand Up @@ -285,12 +298,12 @@ slice begin_parse(cell c) asm "CTOS";
() end_parse(slice s) impure asm "ENDS";

;;; Loads the first reference from the slice.
(slice, cell) load_ref(slice s) asm( -> 1 0) "LDREF";
(slice, cell) load_ref(slice s) asm(-> 1 0) "LDREF";

;;; Preloads the first reference from the slice.
cell preload_ref(slice s) asm "PLDREF";

{- Functions below are commented because are implemented on compilator level for optimisation -}
{- Functions below are commented because are implemented on compilator level for optimisation -}

;;; Loads a signed [len]-bit integer from a slice [s].
;; (slice, int) ~load_int(slice s, int len) asm(s len -> 1 0) "LDIX";
Expand All @@ -311,8 +324,8 @@ cell preload_ref(slice s) asm "PLDREF";
;; slice preload_bits(slice s, int len) asm "PLDSLICEX";

;;; Loads serialized amount of TonCoins (any unsigned integer up to `2^128 - 1`).
(slice, int) load_grams(slice s) asm( -> 1 0) "LDGRAMS";
(slice, int) load_coins(slice s) asm( -> 1 0) "LDGRAMS";
(slice, int) load_grams(slice s) asm(-> 1 0) "LDGRAMS";
(slice, int) load_coins(slice s) asm(-> 1 0) "LDVARUINT16";

;;; Returns all but the first `0 ≤ len ≤ 1023` bits of `slice` [s].
slice skip_bits(slice s, int len) asm "SDSKIPFIRST";
Expand All @@ -330,7 +343,7 @@ slice slice_last(slice s, int len) asm "SDCUTLAST";

;;; Loads a dictionary `D` (HashMapE) from `slice` [s].
;;; (returns `null` if `nothing` constructor is used).
(slice, cell) load_dict(slice s) asm( -> 1 0) "LDDICT";
(slice, cell) load_dict(slice s) asm(-> 1 0) "LDDICT";

;;; Preloads a dictionary `D` from `slice` [s].
cell preload_dict(slice s) asm "PLDDICT";
Expand All @@ -342,7 +355,7 @@ slice skip_dict(slice s) asm "SKIPDICT";
;;; In other words loads 1 bit and if it is true
;;; loads first ref and return it with slice remainder
;;; otherwise returns `null` and slice remainder
(slice, cell) load_maybe_ref(slice s) asm( -> 1 0) "LDOPTREF";
(slice, cell) load_maybe_ref(slice s) asm(-> 1 0) "LDOPTREF";

;;; Preloads (Maybe ^Cell) from `slice` [s].
cell preload_maybe_ref(slice s) asm "PLDOPTREF";
Expand Down Expand Up @@ -434,7 +447,7 @@ builder store_slice(builder b, slice s) asm "STSLICER";
;;;
;;; Store amounts of TonCoins to the builder as VarUInteger 16
builder store_grams(builder b, int x) asm "STGRAMS";
builder store_coins(builder b, int x) asm "STGRAMS";
builder store_coins(builder b, int x) asm "STVARUINT16";

;;; Stores dictionary `D` represented by `cell` [c] or `null` into `builder` [b].
;;; In other words, stores a `1`-bit and a reference to [c] if [c] is not `null` and `0`-bit otherwise.
Expand Down Expand Up @@ -485,7 +498,7 @@ builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF";

;;; Loads from slice [s] the only prefix that is a valid `MsgAddress`,
;;; and returns both this prefix `s'` and the remainder `s''` of [s] as slices.
(slice, slice) load_msg_addr(slice s) asm( -> 1 0) "LDMSGADDR";
(slice, slice) load_msg_addr(slice s) asm(-> 1 0) "LDMSGADDR";

;;; Decomposes slice [s] containing a valid `MsgAddress` into a `tuple t` with separate fields of this `MsgAddress`.
;;; If [s] is not a valid `MsgAddress`, a cell deserialization exception is thrown.
Expand Down Expand Up @@ -618,8 +631,6 @@ int get_seed() impure asm "RANDSEED";
() randomize_lt() impure asm "LTIME" "ADDRAND";

;;; Checks whether the data parts of two slices coinside
int equal_slice_bits(slice a, slice b) asm "SDEQ";
int equal_slices(slice a, slice b) asm "SDEQ";

int equal_slices_bits(slice a, slice b) asm "SDEQ";
;;; Concatenates two builders
builder store_builder(builder to, builder from) asm "STBR";
Loading
Loading