Skip to content

Commit

Permalink
JettonWallet contract in case of using this code as library cells
Browse files Browse the repository at this point in the history
  • Loading branch information
pashinov committed Dec 18, 2024
1 parent 7aeea57 commit 6426f90
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
20 changes: 20 additions & 0 deletions nekoton-contracts/src/jetton/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
Binary file not shown.
9 changes: 7 additions & 2 deletions nekoton-contracts/src/wallets/code/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -38,7 +39,11 @@ static JETTON_LIBRARY_CELLS: once_cell::sync::Lazy<HashMap<UInt256, Cell>> =
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);
Expand Down

0 comments on commit 6426f90

Please sign in to comment.