From ebf6eeba41bd2079ec4c198e68e03f38c82985f3 Mon Sep 17 00:00:00 2001 From: Alexey Pashinov Date: Wed, 18 Dec 2024 13:17:55 +0100 Subject: [PATCH] JettonWallet contract in case of using this code as library cells --- nekoton-contracts/src/jetton/mod.rs | 20 ++++++++++++++++++ .../src/wallets/code/jetton_wallet.boc | Bin 0 -> 1344 bytes nekoton-contracts/src/wallets/code/mod.rs | 9 ++++++-- nekoton-jetton/Cargo.toml | 4 ++-- 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 nekoton-contracts/src/wallets/code/jetton_wallet.boc diff --git a/nekoton-contracts/src/jetton/mod.rs b/nekoton-contracts/src/jetton/mod.rs index 457dc0a7..0d024649 100644 --- a/nekoton-contracts/src/jetton/mod.rs +++ b/nekoton-contracts/src/jetton/mod.rs @@ -302,4 +302,24 @@ mod tests { Ok(()) } + + #[test] + fn mintless_points_token_wallet_contract() -> anyhow::Result<()> { + let cell = + ton_types::deserialize_tree_of_cells(&mut base64::decode("te6ccgEBAwEAyQACbIAMC6d7f4iHKlXHXBfufxF6w/5pIENHdpy1yJnyM+lsrQQNAl2Gc+Ll0AABc7gAAbghs2ElpgIBANQFAlQL5ACADZRqTnEksRaYvpXRMbgzB92SzFv/19WbfQQgdDo7lYwQA+mfQx3OTMfvDyPCOAYxl9HdjYWqWkQCtdgoLLcHjaDKvtRVlwuLLP8LwzhcDJNm1TPewFBFqmlIYet7ln0NupwfCEICDvGeG/QPK6SS/KrDhu7KWb9oJ6OFBwjZ/NmttoOrwzY=").unwrap().as_slice()) + .unwrap(); + let mut state = nekoton_utils::deserialize_account_stuff(cell)?; + + jetton::update_library_cell(&mut state.storage.state)?; + + let contract = jetton::TokenWalletContract(ExecutionContext { + clock: &SimpleClock, + account_stuff: &state, + }); + + let data = contract.get_details()?; + assert_eq!(data.balance.to_u128().unwrap(), 10000000000); + + Ok(()) + } } diff --git a/nekoton-contracts/src/wallets/code/jetton_wallet.boc b/nekoton-contracts/src/wallets/code/jetton_wallet.boc new file mode 100644 index 0000000000000000000000000000000000000000..09f021b5670603e200fb874898fb9eefed8fcb27 GIT binary patch literal 1344 zcmZ{keM}o=9LJyM?%KO6lshQ2fKjecy3HXgP#haX%3x+gaOK6MD6tbGf8YXzEvSgt zc9q39GRERIvt%Vfqgm9UK>^9^hT4`Rv;!PQbm1j2^^YmJRB~KN>Qk6+3Coi_x!-fS z-{<@N{+`^(@0UB4v2+NCO#sq?4&;I&XoQc!X>1z*lxUTu%GIQb>?Fg~Ug{9_Ej2@J z(mMJe-9@|T>$C`yqaZw_3Qq{WIEcX}49Bo3LWV(3t$}~eljT+MvhQymI8oi508Tfa z8Bvv2F(Ldnw2p0(%V(-|gTW zfMd(#GNsANQJPdC`uP$IS@O)jXwI%(BXy@yH{cBcZ;(V=2oT>*E`=0w3^pgJaMxT0 z2@ixGcug4YH>}hg z8RTw8h0lE3GUF9-#OWen_EgBr^Z~U^!eG0FZ<+SviQq#645HCES>-x*dt4aH7CPq* zV%hGs95JgFzb<_BwJ@6OCfbK10MKc8wPq};hr}*Qi(h54ot9#MO!I4Y*Z{v z6dz_cM*x1`W*D?2r+_`P0Y@W6S>1K7F&FT*p!`zLrB_@at8k`!G%b9?V*{I`>4nDV zGzStvx8l9riP7}qp!k~~H7)wyiy1+3mYkJe5t+$^i$|DA^_y32)Y2~Wmr6|og`;A~=6)|v<)v%?0>BR(6#xJL literal 0 HcmV?d00001 diff --git a/nekoton-contracts/src/wallets/code/mod.rs b/nekoton-contracts/src/wallets/code/mod.rs index 309189d5..3fb3de93 100644 --- a/nekoton-contracts/src/wallets/code/mod.rs +++ b/nekoton-contracts/src/wallets/code/mod.rs @@ -26,8 +26,9 @@ declare_tvc! { wallet_v5r1 => "./wallet_v5r1_code.boc" (WALLET_V5R1_CODE), highload_wallet_v2 => "./highload_wallet_v2_code.boc" (HIGHLOAD_WALLET_V2_CODE), ever_wallet => "./ever_wallet_code.boc" (EVER_WALLET_CODE), - jetton_wallet_governed => "./jetton_wallet_governed.boc" (JETTON_WALLET_GOVERNED), + jetton_wallet => "./jetton_wallet.boc" (JETTON_WALLET), jetton_wallet_v2 => "./jetton_wallet_v2.boc" (JETTON_WALLET_V2), + jetton_wallet_governed => "./jetton_wallet_governed.boc" (JETTON_WALLET_GOVERNED), } fn load(mut data: &[u8]) -> Cell { @@ -38,7 +39,11 @@ static JETTON_LIBRARY_CELLS: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| { let mut m = HashMap::new(); - let codes = [jetton_wallet_governed(), jetton_wallet_v2()]; + let codes = [ + jetton_wallet(), + jetton_wallet_v2(), + jetton_wallet_governed(), + ]; for code in codes { m.insert(code.repr_hash(), code); diff --git a/nekoton-jetton/Cargo.toml b/nekoton-jetton/Cargo.toml index f3a4d5b6..8bae8aa6 100644 --- a/nekoton-jetton/Cargo.toml +++ b/nekoton-jetton/Cargo.toml @@ -20,8 +20,8 @@ ton_types = { git = "https://github.com/broxus/ton-labs-types.git" } ton_abi = { git = "https://github.com/broxus/ton-labs-abi" } nekoton-utils = { path = "../nekoton-utils" } -num-bigint = "0.4.6" -num-traits = "0.2.19" +num-bigint = "0.4" +num-traits = "0.2" [features] web = ["ton_abi/web"]