> ## Documentation Index
> Fetch the complete documentation index at: https://docs.saucerswap.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Wrap HBAR for WHBAR

> Wrap native HBAR into WHBAR tokens at a 1:1 ratio through the WhbarHelper deposit function, with token association requirements and a code example.

<Info>
  Contract ID: [WhbarHelper](https://hashscan.io/mainnet/contract/0.0.5808826)
</Info>

<Warning>
  Ensure that the [WHBAR](https://hashscan.io/mainnet/token/0.0.1456986) token ID is associated with the account prior to calling the deposit function. Failure to do so will result in a `TOKEN_NOT_ASSOCIATED_TO_ACCOUNT` error.
</Warning>

Function name: `deposit`

<CodeGroup>
  ```solidity WhbarHelper.sol theme={null}
  function deposit() public payable {
    IWHBAR(whbarContract).deposit{value: msg.value}(msg.sender, msg.sender);
  }
  ```
</CodeGroup>

## Code overview

Recommended gas limit: 100,000

<Tabs>
  <Tab title="JavaScript SDK">
    Resources:

    * [SaucerSwap deployed contract IDs](/developers/contracts)
    * [Hedera JavaScript SDK](https://github.com/hashgraph/hedera-sdk-js)
    * [Associate tokens to an account](https://docs.hedera.com/hedera/sdks-and-apis/sdks/token-service/associate-tokens-to-an-account)
    * [Calling a smart contract function](https://docs.hedera.com/hedera/sdks-and-apis/sdks/smart-contracts/call-a-smart-contract-function)

    ```typescript theme={null}
    import {
      ContractExecuteTransaction,
      TokenAssociateTransaction,
      Hbar,
      HbarUnit
    } from '@hashgraph/sdk';

    //Client pre-checks:
    // - WHBAR token is associated

    const depositHbar = Hbar.from(depositAmount, HbarUnit.Hbar)

    await new ContractExecuteTransaction()
     .setContractId(whbarHelperContractId)
     .setPayableAmount(depositHbar)
     .setGas(gasLim)
     .setFunction('deposit')
     .execute(client);
    ```
  </Tab>
</Tabs>

## Next steps

<CardGroup cols={2}>
  <Card title="Unwrap WHBAR for HBAR" href="/developers/whbar/unwrap-whbar-for-hbar">
    Withdraw WHBAR back to native HBAR.
  </Card>

  <Card title="WHBAR overview" href="/developers/whbar/overview">
    How WHBAR works and its security advisory.
  </Card>
</CardGroup>
