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

# Contract Addresses & Helpers

> Package addresses and helper functions for building Decibel transactions

This page provides the contract addresses and common helper functions you'll need when building transactions directly.

## Package Address

All Decibel transactions use the following package address:

<CodeGroup>
  ```bash Mainnet theme={null}
  0x50ead22afd6ffd9769e3b3d6e0e64a2a350d68e8b102c4e72e33d0b8cfdfdb06
  ```

  ```bash Testnet theme={null}
  0xe7da2794b1d8af76532ed95f38bfdf1136abfd8ea3a240189971988a83101b7f
  ```
</CodeGroup>

## Helper Functions

### Get Market Address

<CodeGroup>
  ```typescript Typescript theme={null}
  import {
    AccountAddress,
    createObjectAddress,
    MoveString,
  } from "@aptos-labs/ts-sdk";

  function getMarketAddr(
    marketName: string,
    perpEngineGlobal: string
  ): AccountAddress {
    const marketNameBytes = new MoveString(marketName).bcsToBytes();
    return createObjectAddress(
      AccountAddress.fromString(perpEngineGlobal),
      marketNameBytes
    );
  }
  ```

  ```python Python theme={null}
  from aptos_sdk.account_address import AccountAddress, create_object_address
  from aptos_sdk.bcs import Serializer

  def get_market_addr(
      market_name: str,
      perp_engine_global: str
  ) -> AccountAddress:
      # Serialize market name as Move string (length-prefixed UTF-8)
      serializer = Serializer()
      serializer.str(market_name)
      market_name_bytes = serializer.output()

      return create_object_address(
          AccountAddress.from_str(perp_engine_global),
          market_name_bytes
      )
  ```
</CodeGroup>

### Get Perp Engine Global Address

<CodeGroup>
  ```typescript Typescript theme={null}
  import { AccountAddress, createObjectAddress } from "@aptos-labs/ts-sdk";

  function getPerpEngineGlobalAddress(packageAddress: string): AccountAddress {
    return createObjectAddress(
      AccountAddress.fromString(packageAddress),
      new TextEncoder().encode("GlobalPerpEngine")
    );
  }
  ```

  ```python Python theme={null}
  from aptos_sdk.account_address import AccountAddress, create_object_address

  def get_perp_engine_global_address(package_address: str) -> AccountAddress:
      return create_object_address(
          AccountAddress.from_str(package_address),
          "GlobalPerpEngine".encode("utf-8")
      )
  ```
</CodeGroup>

## Related

<CardGroup cols={2}>
  <Card title="Optimized Building" href="/developer-hub/on-chain/overview/optimized-building">
    Build transactions synchronously for better performance
  </Card>

  <Card title="Formatting Prices & Sizes" href="/developer-hub/on-chain/overview/formatting-prices-sizes">
    Convert decimal values to chain units
  </Card>
</CardGroup>
