description |
---|
Consume Pyth Network prices in applications on Aptos |
Aptos contracts can update and fetch the Pyth prices using the Pyth Aptos Contract, which has been deployed on Mainnet. The documented source code can be found here.
The mechanism by which price feeds are updated on Aptos is explained here. The pyth-aptos-js package can be used to fetch price feed update data which can be passed to the pyth::update_price
on-chain function.
- Minimal on-chain contract which updates and returns the Pyth BTC/USD price.
- Full-stack React app and on-chain contract which uses the pyth-aptos-js package to update the price used by the contract.
Pyth is currently deployed on Aptos Mainnet.
When deploying contracts using Pyth, the named addresses pyth
, wormhole
and deployer
need to be defined at compile time. These addresses are the same across both Testnet and Mainnet.
Named Address | Value |
---|---|
pyth |
0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387 |
wormhole |
0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625 |
deployer |
0xb31e712b26fd295357355f6845e77c888298636609e93bc9b05f0f604049f434 |
deployer
and wormhole
are implementation details of the Pyth contract: you will not need to interact with these.
Network | Available Price Feeds |
---|---|
Aptos Testnet | https://pyth.network/developers/price-feed-ids#aptos-testnet |
Aptos Mainnet | https://pyth.network/developers/price-feed-ids#aptos-mainnet |