Pyth
Search…
Pyth on BAS Chains
Consume Pyth Network prices in applications on BNB Application Sidechains

Deployment

If, as is highly likely, your BAS chain doesn't already have a deployment of Pyth, you will need to deploy the Pyth2Wormhole receiver contracts yourself. This is easy to do and will enable contracts deployed on your BAS chain to consume Pyth price feeds from the PythUpgradable contract.
To deploy the Pyth2Wormhole receiver contracts to your BAS chain:
  • Add your BAS network details to the Truffle Networks configuration file. An example using BAS test net is configured as below:
    1
    my_bas_testnet: {
    2
    provider: () => new HDWalletProvider(
    3
    process.env.MNEMONIC,
    4
    "https://bas-aries-public.nodereal.io"
    5
    ),
    6
    confirmations: 10,
    7
    networkCheckTimeout: 1000000,
    8
    timeoutBlocks: 1000,
    9
    skipDryRun: true,
    10
    network_id: 117,
    11
    }
    Copied!
  • Prepare a .env.prod.my_bas_testnet environment file in the pyth2wormhole/ethereum directory. Please note if you test the deployment in the test net, you need use the Testnet pyth variable of PYTH_TO_WORMHOLE_EMITTER like below.
    1
    # The truffle network name of your BAS chain, defined in the configuration earlier
    2
    MIGRATIONS_NETWORK=my_bas_testnet
    3
    4
    # Keep these values the same
    5
    MIGRATIONS_DIR=./migrations/prod-receiver
    6
    PYTH_TO_WORMHOLE_CHAIN_ID=0x1
    7
    8
    # Choose this value based on your network type (testnet, mainnet)
    9
    # Testnet Pyth
    10
    PYTH_TO_WORMHOLE_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
    11
    INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
    12
    INIT_GOV_CHAIN_ID=0x1
    13
    INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
    14
    # Mainnet Pyth
    15
    # PYTH_TO_WORMHOLE_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
    16
    # INIT_SIGNERS=["0x58CC3AE5C097b213cE3c81979e1B9f9570746AA5"]
    17
    # INIT_GOV_CHAIN_ID=0x1
    18
    # INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
    19
    20
    # Choose this value based on your network type (testnet, mainnet)
    21
    # Testnet Pyth
    22
    PYTH_TO_WORMHOLE_EMITTER=0xf346195ac02f37d60d4db8ffa6ef74cb1be3550047543a4a9ee9acf4d78697b0
    23
    # Mainnet Pyth
    24
    # PYTH_TO_WORMHOLE_EMITTER=0x6bb14509a612f01fbbc4cffeebd4bbfb492a86df717ebe92eb6df432a3f00a25
    Copied!
  • Now, under the pyth2wormhole/ethereum directory, install dependencies.
    1
    npm install
    Copied!
  • Now run the Truffle migrations inside pyth2wormhole/migrations/prod-receiver using the instructions here. Make sure you are deploying using the right environment file and to the correct network.
  • You can verify the contracts have been deployed successfully using the example here.

Usage

After the pyth2wormhole contracts have been deployed to your BAS chain, please refer to the Pyth on EVM-based chains documentation for how to consume price feeds.
Copy link