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

Update contracts and sourcessrc/contract/wallet/WalletSources.md #245

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adiko02
Copy link

@adiko02 adiko02 commented Aug 28, 2024

No description provided.

@adiko02 adiko02 requested a review from knox0506 August 30, 2024 18:06
@adiko02 adiko02 marked this pull request as draft August 30, 2024 18:06
There is a bunch contracts developed by original TON team for managing TON Coins. Tonweb provide access for most popular ones, here is the way how to rebuild and check them.
## V1 wallet
### revision 1
Fift-ASM for v1 may be found here https://github.com/newton-blockchain/ton/blob/c2da007f4065e2520e0d948b146e0fb12fa75751/crypto/smartcont/new-wallet.fif :

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazgst

* In serialized form `B5EE9C72410101010044000084FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED5441FDF089`

### revision 2
In this revision additional `seqno` get_method was introduced https://github.com/newton-blockchain/ton/blob/47814dca3d4d7d253f0dcbb2ef176f45aafc6871/crypto/smartcont/new-wallet.fif:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seqno

* Cell `x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}`
* In serialized form `B5EE9C724101010100530000A2FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54D0E2786F`
### revision 3
In this revision additional `get_public_key` get_method was introduced https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet.fif:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

```

That gives:
* Cell `x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54}`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* In serialized form `B5EE9C724101010100570000AAFF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54A1370BB6`
### revision 2

Fift-ASM for v2 r2 may be found here https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet-v2.fif (`get_public_key` added) :

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__

@@ -11,7 +11,7 @@ class JettonMinter extends Contract {
*/
constructor(provider, options) {
options.wc = 0;
options.code = options.code || Cell.oneFromBoc('B5EE9C7241020B010001ED000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A60090A03EFD9910E38048ADF068698180B8D848ADF07D201800E98FE99FF6A2687D007D206A6A18400AA9385D47181A9AA8AAE382F9702480FD207D006A18106840306B90FD001812881A28217804502A906428027D012C678B666664F6AA7041083DEECBEF29385D71811A92E001F1811802600271812F82C207F97840607080093DFC142201B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064907C80383A6465816503E5FFE4E83BC00C646582AC678B28027D0109E5B589666664B8FD80400FE3603FA00FA40F82854120870542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05008C705F2E04A12A1035024C85004FA0258CF16CCCCC9ED5401FA403020D70B01C3008E1F8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB00915BE200303515C705F2E049FA403059C85004FA0258CF16CCCCC9ED54002E5143C705F2E049D43001C85004FA0258CF16CCCCC9ED54007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904051007F09');
options.code = options.code || Cell.oneFromBoc('B5EE9C7241020D0100029C000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A600B0C02F1D906380492F81F000E8698180B8D8492F81F07D207D2018FD0018B8EB90FD0018FD001801698FE99FF6A2687D007D206A6A18400AA9385D47199A9A9B1B289A6382F97024817D207D006A18106840306B90FD001812881A282178048A502819E428027D012C678B666664F6AA7041083DEECBEF29385D7181406070093B3F0508806E0A84026A8280790A009F404B19E2C039E2D99924591960225E801E80196019241F200E0E9919605940F97FF93A0EF003191960AB19E2CA009F4042796D625999992E3F60101C036373701FA00FA40F82854120670542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05006C705F2E04AA1034545C85004FA0258CF16CCCCC9ED5401FA403020D70B01C300915BE30D0801A682102C76B9735270BAE30235373723C0038E1A335035C705F2E04903FA403059C85004FA0258CF16CCCCC9ED54E03502C0048E185124C705F2E049D4304300C85004FA0258CF16CCCCC9ED54E05F05840FF2F009003E8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB0001FE365F03820898968015A015BCF2E04B02FA40D3003095C821CF16C9916DE28210D1735400708018C8CB055005CF1624FA0214CB6A13CB1F14CB3F23FA443070BA8E33F828440370542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D0CF16966C227001CB01E2F4000A000AC98040FB00007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904081735FE5');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__

@@ -3,7 +3,7 @@ const {Cell} = require("../../../boc");
const {parseAddress} = require("../nft/NftUtils");
const {BN} = require("../../../utils");

const JETTON_WALLET_CODE_HEX = 'B5EE9C7241021201000328000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900BB0831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C00B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F500F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E801DE0063232C1540233C59C3E8085F2DAC4F3208405E351467232C7C6600C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F009ACB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718018C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B55205ECCF23D';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@Eikyarkway
Copy link

#245 (comment)

@Eikyarkway
Copy link

From f247640 Mon Sep 17 00:00:00 2001
From: EmelyanenkoK [email protected]
Date: Fri, 25 Nov 2022 16:27:25 +0300
Subject: [PATCH] Update contracts and sources


src/contract/ContractSources.md | 425 ++++++++++++++++++++++++++
src/contract/token/ft/JettonMinter.js | 2 +-
src/contract/token/ft/JettonWallet.js | 2 +-
src/contract/token/nft/NftItem.js | 4 +-
src/contract/wallet/WalletSources.md | 335 +-------------------
5 files changed, 430 insertions(+), 338 deletions(-)
create mode 100644 src/contract/ContractSources.md

diff --git a/src/contract/ContractSources.md b/src/contract/ContractSources.md
new file mode 100644
index 00000000..5bda2f95
--- /dev/null
+++ b/src/contract/ContractSources.md
@@ -0,0 +1,425 @@
+# Table of content
+- Original Wallets

+# Original Wallets
+There is a bunch contracts developed by original TON team for managing TON Coins. Tonweb provide access for most popular ones, here is the way how to rebuild and check them.
+## V1 wallet
+### revision 1
+Fift-ASM for v1 may be found here https://github.com/newton-blockchain/ton/blob/c2da007f4065e2520e0d948b146e0fb12fa75751/crypto/smartcont/new-wallet.fif :
+
+```
+#!/usr/bin/fift -s
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET INC 32 THROWIF // return if recv_internal, fail unless recv_external

  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  •  8 LDU LDREF         // pubk cnt mode msg cs
    
  •  s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```

+The idea of the code is as follows:
+1. set codepage 0 (default);
+2. stop execution if it is not external message (which has code -1);
+3. read 512 bits from the incoming message (signature); copy remainder (one copy will be used for parsing another for hashing);
+4. parse 32bit seqno;
+5. load storage, load cell, parse stored seqno and pubkey;
+6. throw if stored seqno is not equal to seqno in message;
+7. hash copy of incoming message (without signature);
+8. check that provided signature signs that hash with accordance to stored public key; throw if not; accept message;
+9. if there is reference in message remainder - parse 8bit mode and send reference as message with that mode;
+10. increase seqno;
+11. store it and pubkey to the storage;
+
+That gives:
+* Cell x{FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
+* In serialized form B5EE9C72410101010044000084FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED5441FDF089
+
+### revision 2
+In this revision additional seqno get_method was introduced https://github.com/newton-blockchain/ton/blob/47814dca3d4d7d253f0dcbb2ef176f45aafc6871/crypto/smartcont/new-wallet.fif:
+```
+#!/usr/bin/fift -s
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF         // pubk cnt mode msg cs
    
  • s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```

+That gives:
+* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
+* In serialized form B5EE9C724101010100530000A2FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54D0E2786F
+### revision 3
+In this revision additional get_public_key get_method was introduced https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet.fif:
+```
+#!/usr/bin/fift -s
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF         // pubk cnt mode msg cs
    
  • s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```

+That gives:
+* Cell x{FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
+* In serialized form B5EE9C7241010101005F0000BAFF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54B5B86E42
+
+## V2 wallet
+
+### revision 1
+
+Fift-ASM for v2 r1 may be found here https://github.com/newton-blockchain/ton/blob/fd7a8de9708c9ece8d802890519735b55bc99a8e/crypto/smartcont/new-wallet-v2.fif
+
+This version introduces valid_until parameter in the message and also allows to send up to 4 internal messages in one tx (each reference of incoming message will be sent).
+
+```
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU // signature in_msg msg_seqno valid_until cs
  • SWAP NOW LEQ 35 THROWIF // signature in_msg msg_seqno cs
  • c4 PUSH CTOS 32 LDU 256 LDU ENDS // signature in_msg msg_seqno cs stored_seqno public_key
  • s3 s1 XCPU // signature in_msg public_key cs stored_seqno msg_seqno stored_seqno
  • EQUAL 33 THROWIFNOT // signature in_msg public_key cs stored_seqno
  • s0 s3 XCHG HASHSU // signature stored_seqno public_key cs hash
  • s0 s4 s2 XC2PU CHKSIGNU 34 THROWIFNOT // cs stored_seqno public_key
  • ACCEPT
  • s0 s2 XCHG // public_key stored_seqno cs
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno cs _40
    
  • }>DO<{ // public_key stored_seqno cs
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno cs _45 mode
    
  • SENDRAWMSG	//  public_key stored_seqno cs
    
  • }>
  • ENDS INC // public_key seqno'
  • NEWC 32 STU 256 STU ENDC c4 POP
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```

+That gives:
+* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54}
+* In serialized form B5EE9C724101010100570000AAFF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54A1370BB6
+### revision 2
+
+Fift-ASM for v2 r2 may be found here https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet-v2.fif (get_public_key added) :
+
+```
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU // signature in_msg msg_seqno valid_until cs
  • SWAP NOW LEQ 35 THROWIF // signature in_msg msg_seqno cs
  • c4 PUSH CTOS 32 LDU 256 LDU ENDS // signature in_msg msg_seqno cs stored_seqno public_key
  • s3 s1 XCPU // signature in_msg public_key cs stored_seqno msg_seqno stored_seqno
  • EQUAL 33 THROWIFNOT // signature in_msg public_key cs stored_seqno
  • s0 s3 XCHG HASHSU // signature stored_seqno public_key cs hash
  • s0 s4 s2 XC2PU CHKSIGNU 34 THROWIFNOT // cs stored_seqno public_key
  • ACCEPT
  • s0 s2 XCHG // public_key stored_seqno cs
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno cs _40
    
  • }>DO<{ // public_key stored_seqno cs
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno cs _45 mode
    
  • SENDRAWMSG	//  public_key stored_seqno cs
    
  • }>
  • ENDS INC // public_key seqno'
  • NEWC 32 STU 256 STU ENDC c4 POP
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```
    +That gives:
    +* Cell x{FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54}
    +* In serialized form `B5EE9C724101010100630000C2FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54044CD7A1`

+## V3 wallet
+### revision 1
+Fift-ASM for v3 may be found here https://github.com/newton-blockchain/ton/blob/3002321eb779e9936243e3b5f00be7579fb07654/crypto/smartcont/new-wallet-v3.fif :
+
+This version introduces subwallet_id parameter of the wallet which allows to create many wallets with the same public key (without risks of replaying messages between the wallets).
+
+```
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU 32 LDU // signature in_msg subwallet_id valid_until msg_seqno cs
  • NOW s1 s3 XCHG LEQ 35 THROWIF // signature in_msg subwallet_id cs msg_seqno
  • c4 PUSH CTOS 32 LDU 32 LDU 256 LDU ENDS // signature in_msg subwallet_id cs msg_seqno stored_seqno stored_subwallet public_key
  • s3 s2 XCPU EQUAL 33 THROWIFNOT // signature in_msg subwallet_id cs public_key stored_seqno stored_subwallet
  • s4 s4 XCPU EQUAL 34 THROWIFNOT // signature in_msg stored_subwallet cs public_key stored_seqno
  • s0 s4 XCHG HASHSU // signature stored_seqno stored_subwallet cs public_key msg_hash
  • s0 s5 s5 XC2PU // public_key stored_seqno stored_subwallet cs msg_hash signature public_key
  • CHKSIGNU 35 THROWIFNOT // public_key stored_seqno stored_subwallet cs
  • ACCEPT
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno stored_subwallet cs _51
    
  • }>DO<{ // public_key stored_seqno stored_subwallet cs
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno stored_subwallet cs _56 mode
    
  • SENDRAWMSG
    
  • }> // public_key stored_seqno stored_subwallet cs
  • ENDS SWAP INC // public_key stored_subwallet seqno'
  • NEWC 32 STU 32 STU 256 STU ENDC c4 POP
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```

+That gives:
+* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED54}
+
+* In serialized form B5EE9C724101010100620000C0FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED543FBE6EE0
+
+### revision 2
+In this revision additional get_public_key was introduced https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/wallet-v3-code.fif:
+```
+"TonUtil.fif" include
+"Asm.fif" include
+<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 32 LDU NIP 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU 32 LDU // signature in_msg subwallet_id valid_until msg_seqno cs
  • NOW s1 s3 XCHG LEQ 35 THROWIF // signature in_msg subwallet_id cs msg_seqno
  • c4 PUSH CTOS 32 LDU 32 LDU 256 LDU ENDS // signature in_msg subwallet_id cs msg_seqno stored_seqno stored_subwallet public_key
  • s3 s2 XCPU EQUAL 33 THROWIFNOT // signature in_msg subwallet_id cs public_key stored_seqno stored_subwallet
  • s4 s4 XCPU EQUAL 34 THROWIFNOT // signature in_msg stored_subwallet cs public_key stored_seqno
  • s0 s4 XCHG HASHSU // signature stored_seqno stored_subwallet cs public_key msg_hash
  • s0 s5 s5 XC2PU // public_key stored_seqno stored_subwallet cs msg_hash signature public_key
  • CHKSIGNU 35 THROWIFNOT // public_key stored_seqno stored_subwallet cs
  • ACCEPT
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno stored_subwallet cs _51
    
  • }>DO<{ // public_key stored_seqno stored_subwallet cs
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno stored_subwallet cs _56 mode
    
  • SENDRAWMSG
    
  • }> // public_key stored_seqno stored_subwallet cs
  • ENDS SWAP INC // public_key stored_subwallet seqno'
  • NEWC 32 STU 32 STU 256 STU ENDC c4 POP
    +}>c
    +dup <s csr.
    +2 boc+>B Bx. cr
    +```
    +That gives:
    +* Cell x{FF0020DD2082014C97BA218201339CBAB19F71B0ED44D0D31FD31F31D70BFFE304E0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED54}

+* In serialized form B5EE9C724101010100710000DEFF0020DD2082014C97BA218201339CBAB19F71B0ED44D0D31FD31F31D70BFFE304E0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED5410BD6DAD
+
+
+# New wallets
+There are also a list of new wallets supported by TonWeb
+
+## V4 wallet
+The main difference from previous versions consist in plugins functionality: trusted conjugated contracts may implement complex logic while being able to use all funds from main wallet.
+
+That way wallet can be extended in numerous ways, including partial, infinite or programmatic allowances, special connectors to specific DApps, custom user-governed add-ons.
+
+More info in original repo wallet-contract
+### revision 1
+Is not used (and never was used in public).
+### revision 2
+* func
+
+* Serialized B5EE9C72410214010002D4000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF264ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1011121302E6D001D0D3032171B0925F04E022D749C120925F04E002D31F218210706C7567BD22821064737472BDB0925F05E003FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F07E005D33FC8258210706C7567BA923830E30D03821064737472BA925F06E30D06070201200809007801FA00F40430F8276F2230500AA121BEF2E0508210706C7567831EB17080185004CB0526CF1658FA0219F400CB6917CB1F5260CB3F20C98040FB0006008A5004810108F45930ED44D0810140D720C801CF16F400C9ED540172B08E23821064737472831EB17080185005CB055003CF1623FA0213CB6ACB1FCB3FC98040FB00925F03E20201200A0B0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580C0D0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200E0F0019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC973FB00C84014810108F451F2A7020070810108D718FA00D33FC8542047810108F451F2A782106E6F746570748018C8CB05CB025006CF165004FA0214CB6A12CB1FCB3FC973FB0002006C810108D718FA00D33F305224810108F459F2A782106473747270748018C8CB05CB025005CF165003FA0213CB6ACB1F12CB3FC973FB00000AF400C9ED54696225E5
+
+## Lockup wallet
+Lockup wallet introduce functionality of temporary locked (can not be spent at all till the moment X) and temporary restricted (can only be sent to white list which usually contains elector till the moment X). Wallet can only have one immutable whitelist (set at contract deploy), but many packages of locked and restricted money (each with it's own time threshold). Creation of new locked/restricted packages is only allowed to owner of second public key (which also is immutable, set at contract deploy and stored in contract storage).
+
+Original repo https://github.com/ton-blockchain/lockup-wallet-contract.
+* func
+* compilled fift-code
+* Cell
+```
+x{FF00F4A413F4BCF2C80B}

  • x{2_}
  • x{4}
  • x{CD}
  • x{2_}
  • x{2_}
    
  •  x{007434C0C05C6C2497C0F83E900C0871C02497C0F80074C7C87040A497C1383C00D46D3C00608420BABE7114AC2F6C2497C338200A208420BABE7106EE86BCBD20084AE0840EE6B2802FBCBD01E0C235C62008087E4055040DBE4404BCBD34C7E00A60840DCEAA7D04EE84BCBD34C034C7CC0078C3C412040DD78CA_}
    
  •   x{1039480AF005}
    
  •   x{1037410AF0050810575056}
    
  •   x{10244300F004ED54}
    
  •  x{0875D27D2A1BE95B0C6_}
    
  • x{5ED44D0D31FD31FD3FFD3FFF404FA00F404FA00F404D1}
    
  • x{2_}
  • x{2_}
    
  •  x{02323287C5F287C572FFC4F2FFFD00007E80BD00007E80BD00326_}
    
  •  x{1448A814C4E0083D039BE865BE803444E800A44C38B21400FE809004E0083D10C06_}
    
  • x{48E1E228020F4966FA520933023BB9131E2209835FA00D113A14013926C21E2B3E630}
    
  • x{2_}
  • x{2_}
  • x{2_}
    
  •  x{B5187E006D88868A82609E00C6207E00C63F04EDE20B3_}
    
  •  x{5}
    
  •   x{ADCE76A268699F98EB85FFC_}
    
  •   x{AC78F6A268698F98EB858FC_}
    
  • x{4}
    
  •  x{B325FB513435C2C7E_}
    
  •  x{B1D1BE08E0804230FB50F62_}
    
  • x{BDE9F780188242F847800C_}
  • x{F28308D71820D31FD31FD31F802403F823BB13F2F2F003802251A9BA1AF2F4802351B7BA1BF2F4801F0BF9015410C5F9101AF2F4F8005057F823F0065098F823F0062071289320D74A8E8BD30731D4511BDB3C12B001E8309229A0DF72FB02069320D74A96D307D402FB00E8D103A4476814154330F004ED54}
  • x{01D0D3030178B0925B7FE0FA4031FA403001F001}
    +```
    +* Serialized B5EE9C7241021E01000261000114FF00F4A413F4BCF2C80B010201200203020148040501F2F28308D71820D31FD31FD31F802403F823BB13F2F2F003802251A9BA1AF2F4802351B7BA1BF2F4801F0BF9015410C5F9101AF2F4F8005057F823F0065098F823F0062071289320D74A8E8BD30731D4511BDB3C12B001E8309229A0DF72FB02069320D74A96D307D402FB00E8D103A4476814154330F004ED541D0202CD0607020120131402012008090201200F100201200A0B002D5ED44D0D31FD31FD3FFD3FFF404FA00F404FA00F404D1803F7007434C0C05C6C2497C0F83E900C0871C02497C0F80074C7C87040A497C1383C00D46D3C00608420BABE7114AC2F6C2497C338200A208420BABE7106EE86BCBD20084AE0840EE6B2802FBCBD01E0C235C62008087E4055040DBE4404BCBD34C7E00A60840DCEAA7D04EE84BCBD34C034C7CC0078C3C412040DD78CA00C0D0E00130875D27D2A1BE95B0C60000C1039480AF00500161037410AF0050810575056001010244300F004ED540201201112004548E1E228020F4966FA520933023BB9131E2209835FA00D113A14013926C21E2B3E6308003502323287C5F287C572FFC4F2FFFD00007E80BD00007E80BD00326000431448A814C4E0083D039BE865BE803444E800A44C38B21400FE809004E0083D10C06002012015160015BDE9F780188242F847800C02012017180201481B1C002DB5187E006D88868A82609E00C6207E00C63F04EDE20B30020158191A0017ADCE76A268699F98EB85FFC00017AC78F6A268698F98EB858FC00011B325FB513435C2C7E00017B1D1BE08E0804230FB50F620002801D0D3030178B0925B7FE0FA4031FA403001F001A80EDAA4

+# NFT
+Repository with code https://github.com/ton-blockchain/token-contract
+## Collection
+* func
+* compilled fift-code
+* Serialized
+B5EE9C724102140100021F000114FF00F4A413F4BCF2C80B0102016202030202CD04050201200E0F04E7D10638048ADF000E8698180B8D848ADF07D201800E98FE99FF6A2687D20699FEA6A6A184108349E9CA829405D47141BAF8280E8410854658056B84008646582A802E78B127D010A65B509E58FE59F80E78B64C0207D80701B28B9E382F970C892E000F18112E001718112E001F181181981E0024060708090201200A0B00603502D33F5313BBF2E1925313BA01FA00D43028103459F0068E1201A44343C85005CF1613CB3FCCCCCCC9ED54925F05E200A6357003D4308E378040F4966FA5208E2906A4208100FABE93F2C18FDE81019321A05325BBF2F402FA00D43022544B30F00623BA9302A402DE04926C21E2B3E6303250444313C85005CF1613CB3FCCCCCCC9ED54002C323401FA40304144C85005CF1613CB3FCCCCCCC9ED54003C8E15D4D43010344130C85005CF1613CB3FCCCCCCC9ED54E05F04840FF2F00201200C0D003D45AF0047021F005778018C8CB0558CF165004FA0213CB6B12CCCCC971FB008002D007232CFFE0A33C5B25C083232C044FD003D0032C03260001B3E401D3232C084B281F2FFF2742002012010110025BC82DF6A2687D20699FEA6A6A182DE86A182C40043B8B5D31ED44D0FA40D33FD4D4D43010245F04D0D431D430D071C8CB0701CF16CCC980201201213002FB5DAFDA89A1F481A67FA9A9A860D883A1A61FA61FF480610002DB4F47DA89A1F481A67FA9A9A86028BE09E008E003E00B01A500C6E
+## NFT Item
+### revision 1
+Outdated, use r2 only
+Repository with code https://github.com/ton-blockchain/token-contract
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241020D010001D0000114FF00F4A413F4BCF2C80B0102016202030202CE04050009A11F9FE00502012006070201200B0C02D70C8871C02497C0F83434C0C05C6C2497C0F83E903E900C7E800C5C75C87E800C7E800C3C00812CE3850C1B088D148CB1C17CB865407E90350C0408FC00F801B4C7F4CFE08417F30F45148C2EA3A1CC840DD78C9004F80C0D0D0D4D60840BF2C9A884AEB8C097C12103FCBC20080900113E910C1C2EBCB8536001F65135C705F2E191FA4021F001FA40D20031FA00820AFAF0801BA121945315A0A1DE22D70B01C300209206A19136E220C2FFF2E192218E3E821005138D91C85009CF16500BCF16712449145446A0708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB00104794102A375BE20A00727082108B77173505C8CBFF5004CF1610248040708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB000082028E3526F0018210D53276DB103744006D71708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB0093303234E25502F003003B3B513434CFFE900835D27080269FC07E90350C04090408F80C1C165B5B60001D00F232CFD633C58073C5B3327B5520BF75041B
+### revision 2
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241020D010001D6000114FF00F4A413F4BCF2C80B0102016202030202CE04050009A11F9FE00502012006070201200B0C02E30C8871C02497C0F83434C0C05C6C2497C0F83E903E900C7E800C5C75C87E800C7E800C1CEA6D003C00812CE3850C1B088D148CB1C17CB865407E90350C0408FC00F801B4C7F4CFE08417F30F45148C2EA3A24C840DD78C9004F6CF380C0D0D0D4D60840BF2C9A884AEB8C097C12103FCBC20080900113E910C1C2EBCB8536001F65135C705F2E191FA4021F001FA40D20031FA00820AFAF0801BA121945315A0A1DE22D70B01C300209206A19136E220C2FFF2E192218E3E821005138D91C85009CF16500BCF16712449145446A0708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB00104794102A375BE20A00727082108B77173505C8CBFF5004CF1610248040708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB000082028E3526F0018210D53276DB103744006D71708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB0093303234E25502F003003B3B513434CFFE900835D27080269FC07E90350C04090408F80C1C165B5B60001D00F232CFD633C58073C5B3327B552009392989
+# Jetton
+Repository with code https://github.com/ton-blockchain/token-contract
+## Minter
+### Basic
+Outdated, use discoverable only
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241020B010001ED000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A60090A03EFD9910E38048ADF068698180B8D848ADF07D201800E98FE99FF6A2687D007D206A6A18400AA9385D47181A9AA8AAE382F9702480FD207D006A18106840306B90FD001812881A28217804502A906428027D012C678B666664F6AA7041083DEECBEF29385D71811A92E001F1811802600271812F82C207F97840607080093DFC142201B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064907C80383A6465816503E5FFE4E83BC00C646582AC678B28027D0109E5B589666664B8FD80400FE3603FA00FA40F82854120870542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05008C705F2E04A12A1035024C85004FA0258CF16CCCCC9ED5401FA403020D70B01C3008E1F8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB00915BE200303515C705F2E049FA403059C85004FA0258CF16CCCCC9ED54002E5143C705F2E049D43001C85004FA0258CF16CCCCC9ED54007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904051007F09
+### Discoverable
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241020D0100029C000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A600B0C02F1D906380492F81F000E8698180B8D8492F81F07D207D2018FD0018B8EB90FD0018FD001801698FE99FF6A2687D007D206A6A18400AA9385D47199A9A9B1B289A6382F97024817D207D006A18106840306B90FD001812881A282178048A502819E428027D012C678B666664F6AA7041083DEECBEF29385D7181406070093B3F0508806E0A84026A8280790A009F404B19E2C039E2D99924591960225E801E80196019241F200E0E9919605940F97FF93A0EF003191960AB19E2CA009F4042796D625999992E3F60101C036373701FA00FA40F82854120670542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05006C705F2E04AA1034545C85004FA0258CF16CCCCC9ED5401FA403020D70B01C300915BE30D0801A682102C76B9735270BAE30235373723C0038E1A335035C705F2E04903FA403059C85004FA0258CF16CCCCC9ED54E03502C0048E185124C705F2E049D4304300C85004FA0258CF16CCCCC9ED54E05F05840FF2F009003E8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB0001FE365F03820898968015A015BCF2E04B02FA40D3003095C821CF16C9916DE28210D1735400708018C8CB055005CF1624FA0214CB6A13CB1F14CB3F23FA443070BA8E33F828440370542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D0CF16966C227001CB01E2F4000A000AC98040FB00007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904081735FE5
+## Jetton wallet
+### revision 1
+Outdated, use r2 only
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241021201000328000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900BB0831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C00B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F500F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E801DE0063232C1540233C59C3E8085F2DAC4F3208405E351467232C7C6600C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F009ACB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718018C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B55205ECCF23D
+### revision 2
+* func
+* compilled fift-code
+* Serialized
+B5EE9C7241021201000334000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900C30831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C1CEA6D0000B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F100F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E800835D270803CB8B11DE0063232C1540233C59C3E8085F2DAC4F3200C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F00AE8210178D4519C8CB1F19CB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718010C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B5520E05BF53E
+# Payment channel
+Repository with code https://github.com/ton-blockchain/payment-channels/
+* func
+* compilled fift-code
+* Serialized
+B5EE9C72410230010007FB000114FF00F4A413F4BCF2C80B0102012002030201480405000AF26C21F0190202CB06070201202E2F020120080902012016170201200A0B0201200C0D0009D3610F80CC001D6B5007434C7FE8034C7CC1BC0FE19E0201580E0F0201201011002D3E11DBC4BE11DBC43232C7FE11DBC47E80B2C7F2407320008B083E1B7B51343480007E187E80007E18BE80007E18F4FFC07E1934FFC07E1974DFC07E19BC01887080A7F4C7C07E1A34C7C07E1A7D01007E1AB7807080E535007E1AF7BE1B2002012012130201201415008D3E13723E11BE117E113E10540132803E10BE80BE10FE8084F2FFC4B2FFF2DFFC02887080A7FE12BE127E121400F2C7C4B2C7FD0037807080E53E12C073253E1333C5B8B27B5520004D1C3C02FE106CFCB8193E803E800C3E1096283E18BE10C0683E18FE10BE10E8006EFCB819BC032000CF1D3C02FE106CFCB819348020C235C6083E4040E4BE1124BE117890CC3E443CB81974C7C060841A5B9A5D2EBCB81A3E118074DFD66EBCB81CBE803E800C3E1094882FBE10D4882FAC3CB819807E18BE18FE12F43E800C3E10BE10E80068006E7CB8199FFE187C0320004120843777222E9C20043232C15401B3C594013E808532DA84B2C7F2DFF2407EC02002012018190201D42B2C0201201A1B0201201E1F0201201C1D00E5473F00BD401D001D401D021F90102D31F01821043436D74BAF2E068F84601D37F59BAF2E072F844544355F910F8454330F910B0F2E065D33FD33F30F84822B9F84922B9B0F2E06C21F86820F869F84A6E915B8E19F84AD0D33FFA003171D721D33F305033BC02BCB1936DF86ADEE2F800F00C8006F3E12F43E800C7E903E900C3E09DBC41CBE10D62F24CC20C1B7BE10FE11963C03FE10BE11A04020BC03DC3E185C3E189C3E18DB7E1ABC032000B51D3C02F5007400750074087E4040B4C7C0608410DB1BDCEEBCB81A3E118074DFD66EBCB81CBE111510D57E443E1150CC3E442C3CB8197E80007E18BE80007E18F4CFF4CFCC3E1208AE7E1248AE6C3CB81B007E1A3E1A7E003C042001C1573F00BF84A6EF2E06AD2008308D71820F9012392F84492F845E24130F910F2E065D31F018210556E436CBAF2E068F84601D37F59BAF2E072D401D08308D71820F901F8444130F910F2E06501D430D08308D71820F901F8454130F910F2E06501820020120222301FED31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE2303205D31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE23032F8485280BEF8495250BEB0524BBE1AB0527ABE19210064B05215BE14B05248BE17B0F2E06970F82305C8CB3F5004FA0215F40015CB3F5004FA0212F400CB1F12CA00CA00C9F86AF00C01C31CFC02FE129BACFCB81AF48020C235C6083E4048E4BE1124BE1178904C3E443CB81974C7C0608410DA19D46EBCB81A3E118074DFD66EBCB81CB5007420C235C6083E407E11104C3E443CB81940750C3420C235C6083E407E11504C3E443CB81940602403F71CFC02FE129BACFCB81AF48020C235C6083E4048E4BE1124BE1178904C3E443CB81974C7C0608410DB10DBAEBCB81A3E118074DFD66EBCB81CBD010C3E12B434CFFE803D0134CFFE803D0134C7FE11DBC4148828083E08EE7CB81BBE11DBC4A83E08EF3CB81C34800C151D5A64D6D4C8F7A2B98E82A49B08B8C3816028292A01FCD31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE2303205D31F01821043685374BAF2E068F84601D37F59BAF2E072D33FFA00F404552003D200019AD401D0D33FFA00F40430937F206DE230325339BE5381BEB0F8495250BEB0F8485290BEB02502FE5237BE16B05262BEB0F2E06927C20097F84918BEF2E0699137E222C20097F84813BEF2E0699132E2F84AD0D33FFA00F404D33FFA00F404D31FF8476F105220A0F823BCF2E06FD200D20030B3F2E073209C3537373A5274BC5263BC12B18E11323939395250BC5299BC18B14650134440E25319BAB3F2E06D9130E30D7F05C82627002496F8476F1114A098F8476F1117A00603E203003ECB3F5004FA0215F40012CB3F5004FA0213F400CB1F12CA00CA00C9F86AF00C00620A8020F4966FA5208E213050038020F4666FA1208E1001FA00ED1E15DA119450C3A00B9133E2923430E202926C21E2B31B000C3535075063140038C8CB3F5004FA0212F400CB3F5003FA0213F400CB1FCA00C9F86AF00C00D51D3C02FE129BACFCB81AFE12B434CFFE803D010C74CFFE803D010C74C7CC3E11DBC4283E11DBC4A83E08EE7CB81C7E003E10886808E87E18BE10D400E816287E18FE10F04026BE10BE10E83E189C3E18F7BE10B04026BE10FE10A83E18DC3E18F780693E1A293E1A7C042001F53B7EF4C7C8608419F1F4A06EA4CC7C037808608403818830AEA54C7C03B6CC780C882084155DD61FAEA54C3C0476CC780820841E6849BBEEA54C3C04B6CC7808208407C546B3EEA54C3C0576CC780820840223AA8CAEA54C3C05B6CC7808208419BDBC1A6EA54C3C05F6CC780C60840950CAA46EA53C0636CC78202D0008840FF2F00075BC7FE3A7805FC25E87D007D207D20184100D0CAF6A1EC7C217C21B7817C227C22B7817C237C23FC247C24B7817C2524C3B7818823881B22A021984008DBD0CABA7805FC20C8B870FC253748B8F07C256840206B90FD0018C020EB90FD0018B8EB90E98F987C23B7882908507C11DE491839707C23B788507C23B789507C11DE48B9F03A4331C4966
+
diff --git a/src/contract/token/ft/JettonMinter.js b/src/contract/token/ft/JettonMinter.js
index 405f74ff..33005d2b 100644
--- a/src/contract/token/ft/JettonMinter.js
+++ b/src/contract/token/ft/JettonMinter.js
@@ -11,7 +11,7 @@ class JettonMinter extends Contract {
*/
constructor(provider, options) {
options.wc = 0;

  •    options.code = options.code || Cell.oneFromBoc('B5EE9C7241020B010001ED000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A60090A03EFD9910E38048ADF068698180B8D848ADF07D201800E98FE99FF6A2687D007D206A6A18400AA9385D47181A9AA8AAE382F9702480FD207D006A18106840306B90FD001812881A28217804502A906428027D012C678B666664F6AA7041083DEECBEF29385D71811A92E001F1811802600271812F82C207F97840607080093DFC142201B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064907C80383A6465816503E5FFE4E83BC00C646582AC678B28027D0109E5B589666664B8FD80400FE3603FA00FA40F82854120870542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05008C705F2E04A12A1035024C85004FA0258CF16CCCCC9ED5401FA403020D70B01C3008E1F8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB00915BE200303515C705F2E049FA403059C85004FA0258CF16CCCCC9ED54002E5143C705F2E049D43001C85004FA0258CF16CCCCC9ED54007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904051007F09');
    
  •    options.code = options.code || Cell.oneFromBoc('B5EE9C7241020D0100029C000114FF00F4A413F4BCF2C80B0102016202030202CC040502037A600B0C02F1D906380492F81F000E8698180B8D8492F81F07D207D2018FD0018B8EB90FD0018FD001801698FE99FF6A2687D007D206A6A18400AA9385D47199A9A9B1B289A6382F97024817D207D006A18106840306B90FD001812881A282178048A502819E428027D012C678B666664F6AA7041083DEECBEF29385D7181406070093B3F0508806E0A84026A8280790A009F404B19E2C039E2D99924591960225E801E80196019241F200E0E9919605940F97FF93A0EF003191960AB19E2CA009F4042796D625999992E3F60101C036373701FA00FA40F82854120670542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D05006C705F2E04AA1034545C85004FA0258CF16CCCCC9ED5401FA403020D70B01C300915BE30D0801A682102C76B9735270BAE30235373723C0038E1A335035C705F2E04903FA403059C85004FA0258CF16CCCCC9ED54E03502C0048E185124C705F2E049D4304300C85004FA0258CF16CCCCC9ED54E05F05840FF2F009003E8210D53276DB708010C8CB055003CF1622FA0212CB6ACB1FCB3FC98042FB0001FE365F03820898968015A015BCF2E04B02FA40D3003095C821CF16C9916DE28210D1735400708018C8CB055005CF1624FA0214CB6A13CB1F14CB3F23FA443070BA8E33F828440370542013541403C85004FA0258CF1601CF16CCC922C8CB0112F400F400CB00C9F9007074C8CB02CA07CBFFC9D0CF16966C227001CB01E2F4000A000AC98040FB00007DADBCF6A2687D007D206A6A183618FC1400B82A1009AA0A01E428027D012C678B00E78B666491646580897A007A00658064FC80383A6465816503E5FFE4E840001FAF16F6A2687D007D206A6A183FAA904081735FE5');
       super(provider, options);
    
    }

diff --git a/src/contract/token/ft/JettonWallet.js b/src/contract/token/ft/JettonWallet.js
index 3e7377f2..64d20eb5 100644
--- a/src/contract/token/ft/JettonWallet.js
+++ b/src/contract/token/ft/JettonWallet.js
@@ -3,7 +3,7 @@ const {Cell} = require("../../../boc");
const {parseAddress} = require("../nft/NftUtils");
const {BN} = require("../../../utils");

-const JETTON_WALLET_CODE_HEX = 'B5EE9C7241021201000328000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900BB0831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C00B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F500F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E801DE0063232C1540233C59C3E8085F2DAC4F3208405E351467232C7C6600C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F009ACB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718018C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B55205ECCF23D';
+const JETTON_WALLET_CODE_HEX = 'B5EE9C7241021201000334000114FF00F4A413F4BCF2C80B0102016202030202CC0405001BA0F605DA89A1F401F481F481A8610201D40607020148080900C30831C02497C138007434C0C05C6C2544D7C0FC02F83E903E900C7E800C5C75C87E800C7E800C1CEA6D0000B4C7E08403E29FA954882EA54C4D167C0238208405E3514654882EA58C511100FC02780D60841657C1EF2EA4D67C02B817C12103FCBC2000113E910C1C2EBCB853600201200A0B020120101101F100F4CFFE803E90087C007B51343E803E903E90350C144DA8548AB1C17CB8B04A30BFFCB8B0950D109C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C032483E401C1D3232C0B281F2FFF274013E903D010C7E800835D270803CB8B11DE0063232C1540233C59C3E8085F2DAC4F3200C03F73B51343E803E903E90350C0234CFFE80145468017E903E9014D6F1C1551CDB5C150804D50500F214013E809633C58073C5B33248B232C044BD003D0032C0327E401C1D3232C0B281F2FFF274140371C1472C7CB8B0C2BE80146A2860822625A020822625A004AD822860822625A028062849F8C3C975C2C070C008E00D0E0F00AE8210178D4519C8CB1F19CB3F5007FA0222CF165006CF1625FA025003CF16C95005CC2391729171E25008A813A08208989680AA008208989680A0A014BCF2E2C504C98040FB001023C85004FA0258CF1601CF16CCC9ED5400705279A018A182107362D09CC8CB1F5230CB3F58FA025007CF165007CF16C9718010C8CB0524CF165006FA0215CB6A14CCC971FB0010241023000E10491038375F040076C200B08E218210D53276DB708010C8CB055008CF165004FA0216CB6A12CB1F12CB3FC972FB0093356C21E203C85004FA0258CF1601CF16CCC9ED5400DB3B51343E803E903E90350C01F4CFFE803E900C145468549271C17CB8B049F0BFFCB8B0A0822625A02A8005A805AF3CB8B0E0841EF765F7B232C7C572CFD400FE8088B3C58073C5B25C60063232C14933C59C3E80B2DAB33260103EC01004F214013E809633C58073C5B3327B55200083200835C87B51343E803E903E90350C0134C7E08405E3514654882EA0841EF765F784EE84AC7CB8B174CFCC7E800C04E81408F214013E809633C58073C5B3327B5520E05BF53E';

class JettonWallet extends Contract {
/**
diff --git a/src/contract/token/nft/NftItem.js b/src/contract/token/nft/NftItem.js
index 0dde019d..c1b31327 100644
--- a/src/contract/token/nft/NftItem.js
+++ b/src/contract/token/nft/NftItem.js
@@ -5,7 +5,7 @@ const {parseAddress, getRoyaltyParams} = require('./NftUtils.js');
const {parseOffchainUriCell} = require("./NftUtils");

// https://github.com/ton-blockchain/token-contract/blob/1ad314a98d20b41241d5329e1786fc894ad811de/nft/nft-item.fc
-const NFT_ITEM_CODE_HEX = 'B5EE9C7241020D010001D0000114FF00F4A413F4BCF2C80B0102016202030202CE04050009A11F9FE00502012006070201200B0C02D70C8871C02497C0F83434C0C05C6C2497C0F83E903E900C7E800C5C75C87E800C7E800C3C00812CE3850C1B088D148CB1C17CB865407E90350C0408FC00F801B4C7F4CFE08417F30F45148C2EA3A1CC840DD78C9004F80C0D0D0D4D60840BF2C9A884AEB8C097C12103FCBC20080900113E910C1C2EBCB8536001F65135C705F2E191FA4021F001FA40D20031FA00820AFAF0801BA121945315A0A1DE22D70B01C300209206A19136E220C2FFF2E192218E3E821005138D91C85009CF16500BCF16712449145446A0708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB00104794102A375BE20A00727082108B77173505C8CBFF5004CF1610248040708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB000082028E3526F0018210D53276DB103744006D71708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB0093303234E25502F003003B3B513434CFFE900835D27080269FC07E90350C04090408F80C1C165B5B60001D00F232CFD633C58073C5B3327B5520BF75041B';
+const NFT_ITEM_CODE_HEX = 'B5EE9C7241020D010001D6000114FF00F4A413F4BCF2C80B0102016202030202CE04050009A11F9FE00502012006070201200B0C02E30C8871C02497C0F83434C0C05C6C2497C0F83E903E900C7E800C5C75C87E800C7E800C1CEA6D003C00812CE3850C1B088D148CB1C17CB865407E90350C0408FC00F801B4C7F4CFE08417F30F45148C2EA3A24C840DD78C9004F6CF380C0D0D0D4D60840BF2C9A884AEB8C097C12103FCBC20080900113E910C1C2EBCB8536001F65135C705F2E191FA4021F001FA40D20031FA00820AFAF0801BA121945315A0A1DE22D70B01C300209206A19136E220C2FFF2E192218E3E821005138D91C85009CF16500BCF16712449145446A0708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB00104794102A375BE20A00727082108B77173505C8CBFF5004CF1610248040708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB000082028E3526F0018210D53276DB103744006D71708010C8CB055007CF165005FA0215CB6A12CB1FCB3F226EB39458CF17019132E201C901FB0093303234E25502F003003B3B513434CFFE900835D27080269FC07E90350C04090408F80C1C165B5B60001D00F232CFD633C58073C5B3327B552009392989';

class NftItem extends Contract {
/**
@@ -102,4 +102,4 @@ class NftItem extends Contract {

NftItem.codeHex = NFT_ITEM_CODE_HEX;

-module.exports = {NftItem};
\ No newline at end of file
+module.exports = {NftItem};
diff --git a/src/contract/wallet/WalletSources.md b/src/contract/wallet/WalletSources.md
index b4eae78f..8478c657 100644
--- a/src/contract/wallet/WalletSources.md
+++ b/src/contract/wallet/WalletSources.md
@@ -1,334 +1 @@
-# Original Wallets
-There is a bunch contracts developed by original TON team for managing TON Coins. Tonweb provide access for most popular ones, here is the way how to rebuild and check them.
-## V1 wallet
-Fift-ASM for v1 may be found here https://github.com/newton-blockchain/ton/blob/c2da007f4065e2520e0d948b146e0fb12fa75751/crypto/smartcont/new-wallet.fif :

-```
-#!/usr/bin/fift -s
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET INC 32 THROWIF // return if recv_internal, fail unless recv_external

  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  •  8 LDU LDREF         // pubk cnt mode msg cs
    
  •  s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```

-The idea of the code is as follows:
-1. set codepage 0 (default);
-2. stop execution if it is not external message (which has code -1);
-3. read 512 bits from the incoming message (signature); copy remainder (one copy will be used for parsing another for hashing);
-4. parse 32bit seqno;
-5. load storage, load cell, parse stored seqno and pubkey;
-6. throw if stored seqno is not equal to seqno in message;
-7. hash copy of incoming message (without signature);
-8. check that provided signature signs that hash with accordance to stored public key; throw if not; accept message;
-9. if there is reference in message remainder - parse 8bit mode and send reference as message with that mode;
-10. increase seqno;
-11. store it and pubkey to the storage;

-That gives:
-* Cell x{FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
-* In serialized form B5EE9C72410101010044000084FF0020DDA4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED5441FDF089

-### revision 2
-In this revision additional seqno get_method was introduced https://github.com/newton-blockchain/ton/blob/47814dca3d4d7d253f0dcbb2ef176f45aafc6871/crypto/smartcont/new-wallet.fif:
-```
-#!/usr/bin/fift -s
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF         // pubk cnt mode msg cs
    
  • s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```

-That gives:
-* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
-* In serialized form B5EE9C724101010100530000A2FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54D0E2786F
-### revision 3
-In this revision additional get_public_key get_method was introduced https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet.fif:
-```
-#!/usr/bin/fift -s
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 512 INT LDSLICEX DUP 32 PLDU // sign cs cnt
  • c4 PUSHCTR CTOS 32 LDU 256 LDU ENDS // sign cs cnt cnt' pubk
  • s1 s2 XCPU // sign cs cnt pubk cnt' cnt
  • EQUAL 33 THROWIFNOT // ( seqno mismatch? )
  • s2 PUSH HASHSU // sign cs cnt pubk hash
  • s0 s4 s4 XC2PU // pubk cs cnt hash sign pubk
  • CHKSIGNU // pubk cs cnt ?
  • 34 THROWIFNOT // signature mismatch
  • ACCEPT
  • SWAP 32 LDU NIP
  • DUP SREFS IF:<{
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF         // pubk cnt mode msg cs
    
  • s0 s2 XCHG SENDRAWMSG  // pubk cnt cs ; ( message sent )
    
  • }>
  • ENDS
  • INC NEWC 32 STU 256 STU ENDC c4 POPCTR
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```

-That gives:
-* Cell x{FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54}
-* In serialized form B5EE9C7241010101005F0000BAFF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54B5B86E42

-## V2 wallet

-### revision 1

-Fift-ASM for v2 r1 may be found here https://github.com/newton-blockchain/ton/blob/fd7a8de9708c9ece8d802890519735b55bc99a8e/crypto/smartcont/new-wallet-v2.fif

-This version introduces valid_until parameter in the message and also allows to send up to 4 internal messages in one tx (each reference of incoming message will be sent).

-```
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU // signature in_msg msg_seqno valid_until cs
  • SWAP NOW LEQ 35 THROWIF // signature in_msg msg_seqno cs
  • c4 PUSH CTOS 32 LDU 256 LDU ENDS // signature in_msg msg_seqno cs stored_seqno public_key
  • s3 s1 XCPU // signature in_msg public_key cs stored_seqno msg_seqno stored_seqno
  • EQUAL 33 THROWIFNOT // signature in_msg public_key cs stored_seqno
  • s0 s3 XCHG HASHSU // signature stored_seqno public_key cs hash
  • s0 s4 s2 XC2PU CHKSIGNU 34 THROWIFNOT // cs stored_seqno public_key
  • ACCEPT
  • s0 s2 XCHG // public_key stored_seqno cs
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno cs _40
    
  • }>DO<{ // public_key stored_seqno cs
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno cs _45 mode
    
  • SENDRAWMSG	//  public_key stored_seqno cs
    
  • }>
  • ENDS INC // public_key seqno'
  • NEWC 32 STU 256 STU ENDC c4 POP
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```

-That gives:
-* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54}
-* In serialized form B5EE9C724101010100570000AAFF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54A1370BB6
-### revision 2

-Fift-ASM for v2 r2 may be found here https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/new-wallet-v2.fif (get_public_key added) :

-```
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU // signature in_msg msg_seqno valid_until cs
  • SWAP NOW LEQ 35 THROWIF // signature in_msg msg_seqno cs
  • c4 PUSH CTOS 32 LDU 256 LDU ENDS // signature in_msg msg_seqno cs stored_seqno public_key
  • s3 s1 XCPU // signature in_msg public_key cs stored_seqno msg_seqno stored_seqno
  • EQUAL 33 THROWIFNOT // signature in_msg public_key cs stored_seqno
  • s0 s3 XCHG HASHSU // signature stored_seqno public_key cs hash
  • s0 s4 s2 XC2PU CHKSIGNU 34 THROWIFNOT // cs stored_seqno public_key
  • ACCEPT
  • s0 s2 XCHG // public_key stored_seqno cs
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno cs _40
    
  • }>DO<{ // public_key stored_seqno cs
  • // 3 INT 35 LSHIFT# 3 INT RAWRESERVE    // reserve all but 103 Grams from the balance
    
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno cs _45 mode
    
  • SENDRAWMSG	//  public_key stored_seqno cs
    
  • }>
  • ENDS INC // public_key seqno'
  • NEWC 32 STU 256 STU ENDC c4 POP
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```
    -That gives:
    -* Cell x{FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54}
    -* In serialized form `B5EE9C724101010100630000C2FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F2608308D71820D31FD31F01F823BBF263ED44D0D31FD3FFD15131BAF2A103F901541042F910F2A2F800029320D74A96D307D402FB00E8D1A4C8CB1FCBFFC9ED54044CD7A1`

-## V3 wallet
-Fift-ASM for v3 may be found here https://github.com/newton-blockchain/ton/blob/3002321eb779e9936243e3b5f00be7579fb07654/crypto/smartcont/new-wallet-v3.fif :

-This version introduces subwallet_id parameter of the wallet which allows to create many wallets with the same public key (without risks of replaying messages between the wallets).

-```
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL IFJMP:<{ // "seqno" get-method
  • DROP c4 PUSHCTR CTOS 32 PLDU  // cnt
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU 32 LDU // signature in_msg subwallet_id valid_until msg_seqno cs
  • NOW s1 s3 XCHG LEQ 35 THROWIF // signature in_msg subwallet_id cs msg_seqno
  • c4 PUSH CTOS 32 LDU 32 LDU 256 LDU ENDS // signature in_msg subwallet_id cs msg_seqno stored_seqno stored_subwallet public_key
  • s3 s2 XCPU EQUAL 33 THROWIFNOT // signature in_msg subwallet_id cs public_key stored_seqno stored_subwallet
  • s4 s4 XCPU EQUAL 34 THROWIFNOT // signature in_msg stored_subwallet cs public_key stored_seqno
  • s0 s4 XCHG HASHSU // signature stored_seqno stored_subwallet cs public_key msg_hash
  • s0 s5 s5 XC2PU // public_key stored_seqno stored_subwallet cs msg_hash signature public_key
  • CHKSIGNU 35 THROWIFNOT // public_key stored_seqno stored_subwallet cs
  • ACCEPT
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno stored_subwallet cs _51
    
  • }>DO<{ // public_key stored_seqno stored_subwallet cs
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno stored_subwallet cs _56 mode
    
  • SENDRAWMSG
    
  • }> // public_key stored_seqno stored_subwallet cs
  • ENDS SWAP INC // public_key stored_subwallet seqno'
  • NEWC 32 STU 32 STU 256 STU ENDC c4 POP
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```

-That gives:
-* Cell x{FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED54}

-* In serialized form B5EE9C724101010100620000C0FF0020DD2082014C97BA9730ED44D0D70B1FE0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED543FBE6EE0

-### revision 2
-In this revision additional get_public_key was introduced https://github.com/newton-blockchain/ton/blob/master/crypto/smartcont/wallet-v3-code.fif:
-```
-"TonUtil.fif" include
-"Asm.fif" include
-<{ SETCP0 DUP IFNOTRET // return if recv_internal

  • DUP 85143 INT EQUAL OVER 78748 INT EQUAL OR IFJMP:<{ // "seqno" and "get_public_key" get-methods
  • 1 INT AND c4 PUSHCTR CTOS 32 LDU 32 LDU NIP 256 PLDU CONDSEL  // cnt or pubk
    
  • }>
  • INC 32 THROWIF // fail unless recv_external
  • 9 PUSHPOW2 LDSLICEX DUP 32 LDU 32 LDU 32 LDU // signature in_msg subwallet_id valid_until msg_seqno cs
  • NOW s1 s3 XCHG LEQ 35 THROWIF // signature in_msg subwallet_id cs msg_seqno
  • c4 PUSH CTOS 32 LDU 32 LDU 256 LDU ENDS // signature in_msg subwallet_id cs msg_seqno stored_seqno stored_subwallet public_key
  • s3 s2 XCPU EQUAL 33 THROWIFNOT // signature in_msg subwallet_id cs public_key stored_seqno stored_subwallet
  • s4 s4 XCPU EQUAL 34 THROWIFNOT // signature in_msg stored_subwallet cs public_key stored_seqno
  • s0 s4 XCHG HASHSU // signature stored_seqno stored_subwallet cs public_key msg_hash
  • s0 s5 s5 XC2PU // public_key stored_seqno stored_subwallet cs msg_hash signature public_key
  • CHKSIGNU 35 THROWIFNOT // public_key stored_seqno stored_subwallet cs
  • ACCEPT
  • WHILE:<{
  • DUP SREFS	//  public_key stored_seqno stored_subwallet cs _51
    
  • }>DO<{ // public_key stored_seqno stored_subwallet cs
  • 8 LDU LDREF s0 s2 XCHG	//  public_key stored_seqno stored_subwallet cs _56 mode
    
  • SENDRAWMSG
    
  • }> // public_key stored_seqno stored_subwallet cs
  • ENDS SWAP INC // public_key stored_subwallet seqno'
  • NEWC 32 STU 32 STU 256 STU ENDC c4 POP
    -}>c
    -dup <s csr.
    -2 boc+>B Bx. cr
    -```
    -That gives:
    -* Cell x{FF0020DD2082014C97BA218201339CBAB19F71B0ED44D0D31FD31F31D70BFFE304E0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED54}

-* In serialized form B5EE9C724101010100710000DEFF0020DD2082014C97BA218201339CBAB19F71B0ED44D0D31FD31F31D70BFFE304E0A4F2608308D71820D31FD31FD31FF82313BBF263ED44D0D31FD31FD3FFD15132BAF2A15144BAF2A204F901541055F910F2A3F8009320D74A96D307D402FB00E8D101A4C8CB1FCB1FCBFFC9ED5410BD6DAD

-# New wallets
-There are also a list of new wallets supported by TonWeb

-## V4 wallet
-The main difference from previous versions consist in plugins functionality: trusted conjugated contracts may implement complex logic while being able to use all funds from main wallet.

-That way wallet can be extended in numerous ways, including partial, infinite or programmatic allowances, special connectors to specific DApps, custom user-governed add-ons.

-More info in original repo wallet-contract
-### revision 1
-Is not used (and never was used in public).
-### revision 2
-* func

-* Serialized B5EE9C72410214010002D4000114FF00F4A413F4BCF2C80B010201200203020148040504F8F28308D71820D31FD31FD31F02F823BBF264ED44D0D31FD31FD3FFF404D15143BAF2A15151BAF2A205F901541064F910F2A3F80024A4C8CB1F5240CB1F5230CBFF5210F400C9ED54F80F01D30721C0009F6C519320D74A96D307D402FB00E830E021C001E30021C002E30001C0039130E30D03A4C8CB1F12CB1FCBFF1011121302E6D001D0D3032171B0925F04E022D749C120925F04E002D31F218210706C7567BD22821064737472BDB0925F05E003FA403020FA4401C8CA07CBFFC9D0ED44D0810140D721F404305C810108F40A6FA131B3925F07E005D33FC8258210706C7567BA923830E30D03821064737472BA925F06E30D06070201200809007801FA00F40430F8276F2230500AA121BEF2E0508210706C7567831EB17080185004CB0526CF1658FA0219F400CB6917CB1F5260CB3F20C98040FB0006008A5004810108F45930ED44D0810140D720C801CF16F400C9ED540172B08E23821064737472831EB17080185005CB055003CF1623FA0213CB6ACB1FCB3FC98040FB00925F03E20201200A0B0059BD242B6F6A2684080A06B90FA0218470D4080847A4937D29910CE6903E9FF9837812801B7810148987159F31840201580C0D0011B8C97ED44D0D70B1F8003DB29DFB513420405035C87D010C00B23281F2FFF274006040423D029BE84C600201200E0F0019ADCE76A26840206B90EB85FFC00019AF1DF6A26840106B90EB858FC0006ED207FA00D4D422F90005C8CA0715CBFFC9D077748018C8CB05CB0222CF165005FA0214CB6B12CCCCC973FB00C84014810108F451F2A7020070810108D718FA00D33FC8542047810108F451F2A782106E6F746570748018C8CB05CB025006CF165004FA0214CB6A12CB1FCB3FC973FB0002006C810108D718FA00D33F305224810108F459F2A782106473747270748018C8CB05CB025005CF165003FA0213CB6ACB1F12CB3FC973FB00000AF400C9ED54696225E5

-## Lockup wallet
-Lockup wallet introduce functionality of temporary locked (can not be spent at all till the moment X) and temporary restricted (can only be sent to white list which usually contains elector till the moment X). Wallet can only have one immutable whitelist (set at contract deploy), but many packages of locked and restricted money (each with it's own time threshold). Creation of new locked/restricted packages is only allowed to owner of second public key (which also is immutable, set at contract deploy and stored in contract storage).

-Original repo https://github.com/ton-blockchain/lockup-wallet-contract.
-* func
-* compilled fift-code
-* Cell
-```
-x{FF00F4A413F4BCF2C80B}

  • x{2_}
  • x{4}
  • x{CD}
  • x{2_}
  • x{2_}
    
  •  x{007434C0C05C6C2497C0F83E900C0871C02497C0F80074C7C87040A497C1383C00D46D3C00608420BABE7114AC2F6C2497C338200A208420BABE7106EE86BCBD20084AE0840EE6B2802FBCBD01E0C235C62008087E4055040DBE4404BCBD34C7E00A60840DCEAA7D04EE84BCBD34C034C7CC0078C3C412040DD78CA_}
    
  •   x{1039480AF005}
    
  •   x{1037410AF0050810575056}
    
  •   x{10244300F004ED54}
    
  •  x{0875D27D2A1BE95B0C6_}
    
  • x{5ED44D0D31FD31FD3FFD3FFF404FA00F404FA00F404D1}
    
  • x{2_}
  • x{2_}
    
  •  x{02323287C5F287C572FFC4F2FFFD00007E80BD00007E80BD00326_}
    
  •  x{1448A814C4E0083D039BE865BE803444E800A44C38B21400FE809004E0083D10C06_}
    
  • x{48E1E228020F4966FA520933023BB9131E2209835FA00D113A14013926C21E2B3E630}
    
  • x{2_}
  • x{2_}
  • x{2_}
    
  •  x{B5187E006D88868A82609E00C6207E00C63F04EDE20B3_}
    
  •  x{5}
    
  •   x{ADCE76A268699F98EB85FFC_}
    
  •   x{AC78F6A268698F98EB858FC_}
    
  • x{4}
    
  •  x{B325FB513435C2C7E_}
    
  •  x{B1D1BE08E0804230FB50F62_}
    
  • x{BDE9F780188242F847800C_}
  • x{F28308D71820D31FD31FD31F802403F823BB13F2F2F003802251A9BA1AF2F4802351B7BA1BF2F4801F0BF9015410C5F9101AF2F4F8005057F823F0065098F823F0062071289320D74A8E8BD30731D4511BDB3C12B001E8309229A0DF72FB02069320D74A96D307D402FB00E8D103A4476814154330F004ED54}
  • x{01D0D3030178B0925B7FE0FA4031FA403001F001}
    -```
    -* Serialized B5EE9C7241021E01000261000114FF00F4A413F4BCF2C80B010201200203020148040501F2F28308D71820D31FD31FD31F802403F823BB13F2F2F003802251A9BA1AF2F4802351B7BA1BF2F4801F0BF9015410C5F9101AF2F4F8005057F823F0065098F823F0062071289320D74A8E8BD30731D4511BDB3C12B001E8309229A0DF72FB02069320D74A96D307D402FB00E8D103A4476814154330F004ED541D0202CD0607020120131402012008090201200F100201200A0B002D5ED44D0D31FD31FD3FFD3FFF404FA00F404FA00F404D1803F7007434C0C05C6C2497C0F83E900C0871C02497C0F80074C7C87040A497C1383C00D46D3C00608420BABE7114AC2F6C2497C338200A208420BABE7106EE86BCBD20084AE0840EE6B2802FBCBD01E0C235C62008087E4055040DBE4404BCBD34C7E00A60840DCEAA7D04EE84BCBD34C034C7CC0078C3C412040DD78CA00C0D0E00130875D27D2A1BE95B0C60000C1039480AF00500161037410AF0050810575056001010244300F004ED540201201112004548E1E228020F4966FA520933023BB9131E2209835FA00D113A14013926C21E2B3E6308003502323287C5F287C572FFC4F2FFFD00007E80BD00007E80BD00326000431448A814C4E0083D039BE865BE803444E800A44C38B21400FE809004E0083D10C06002012015160015BDE9F780188242F847800C02012017180201481B1C002DB5187E006D88868A82609E00C6207E00C63F04EDE20B30020158191A0017ADCE76A268699F98EB85FFC00017AC78F6A268698F98EB858FC00011B325FB513435C2C7E00017B1D1BE08E0804230FB50F620002801D0D3030178B0925B7FE0FA4031FA403001F001A80EDAA4
    +Moved to ContractSources.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants