Skip to content

Commit 57424bd

Browse files
authored
Use CW instead of Terra wherever possible (#63)
There are still some places that Terra is mentioned such as deploy scripts and available networks. We should update them later.
1 parent 5c0208d commit 57424bd

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Key features of this SDK include:
77
* Get the current price of over [50 products](https://pyth.network/markets/), including cryptocurrencies,
88
US equities, forex and more.
99
* Combine listed products to create new price feeds, e.g., for baskets of tokens or non-USD quote currencies.
10-
* Consume prices in Solana programs, Terra smart contracts, or off-chain applications.
10+
* Consume prices in Solana programs, CosmWasm smart contracts, or off-chain applications.
1111

1212
Please see the [pyth.network documentation](https://docs.pyth.network/) for more information about pyth.network.
1313

@@ -18,7 +18,7 @@ This repository is divided into several crates focused on specific use cases:
1818
1. [Pyth SDK](pyth-sdk) provides common data types and interfaces for that are shared across different blockchains.
1919
2. [Pyth SDK Solana](pyth-sdk-solana) provides an interface for reading Pyth price feeds in Solana programs.
2020
This crate may also be used in off-chain applications that read prices from the Solana blockchain.
21-
3. [Pyth SDK Terra](pyth-sdk-terra) provides an interface for reading Pyth price feeds in on-chain Terra contracts.
21+
3. [Pyth SDK CosmWasm](pyth-sdk-cw) provides an interface for reading Pyth price feeds in on-chain CosmWasm contracts.
2222

2323
Please see the documentation for the relevant crate to get started using Pyth Network.
2424

examples/cw-contract/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "example-terra-contract"
2+
name = "example-cw-contract"
33
version = "0.1.0"
44
authors = ["Ali Behjati <bahjatia@gmail.com>"]
55
edition = "2018"

examples/cw-contract/Developing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ rustup target list --installed
1919
rustup target add wasm32-unknown-unknown
2020
```
2121

22-
This example uses relative paths in `Cargo.toml`; you must remove any `path` components within `Cargo.toml` dependencies if you intend to compile this code outside of the `pyth-sdk-terra` repository, otherwise this will fail to compile. For example:
22+
This example uses relative paths in `Cargo.toml`; you must remove any `path` components within `Cargo.toml` dependencies if you intend to compile this code outside of the `pyth-sdk-cw` repository, otherwise this will fail to compile. For example:
2323

2424
```diff
25-
- pyth-sdk-terra = { version = "0.4.0", path = "../../pyth-sdk-terra" }
26-
+ pyth-sdk-terra = { version = "0.4.0" }
25+
- pyth-sdk-cw = { version = "0.1.0", path = "../../pyth-sdk-cw" }
26+
+ pyth-sdk-cw = { version = "0.1.0" }
2727
```
2828

2929
## Compiling
@@ -32,7 +32,7 @@ After changing the contract, make sure you can compile and run it before
3232
making any changes. Go into the repository and do:
3333

3434
```sh
35-
# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/exxamle_terra_contract.wasm
35+
# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/example_cw_contract.wasm
3636
cargo build --release --target wasm32-unknown-unknown
3737
```
3838
## Generating JSON Schema

examples/cw-contract/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Pyth SDK Example Contract for Terra
1+
# Pyth SDK Example Contract for CosmWasm
22

33
This repository contains an example contract that demonstrates how to read the Pyth price from the Pyth on-chain contract.
44
The example [contract](src/contract.rs) has two functions:
55

66
* `instantiate` sets the Pyth contract address and price feed id that the contract uses.
77
This function is intended to be called once when the contract is deployed.
8-
See the [Terra SDK README](../../pyth-sdk-terra/README.md) for the list of possible price feed ids.
8+
See the [CosmWasm SDK README](../../pyth-sdk-cw/README.md) for the list of possible price feed ids.
99
* `query` queries the Pyth contract to get the current price for the configured price feed id.
1010

1111
## Testnet Demo
@@ -52,7 +52,7 @@ If you would like to deploy a changed version of this contract, the process cons
5252
### Build WASM
5353

5454
See the [Developing instructions](Developing.md) for how to build the WASM for the contract.
55-
The instructions in that document will build a file called `example_terra_contract.wasm` under the `artifacts/` directory.
55+
The instructions in that document will build a file called `example_cw_contract.wasm` under the `artifacts/` directory.
5656

5757
### Upload and Instantiate Contract
5858

@@ -62,15 +62,15 @@ You can run that script on the built WASM file as follows:
6262
``` sh
6363
cd tools/
6464
npm install
65-
npm run deploy -- --network testnet --artifact ../artifacts/example_terra_contract.wasm --mnemonic "..." --instantiate
65+
npm run deploy -- --network testnet --artifact ../artifacts/example_cw_contract.wasm --mnemonic "..." --instantiate
6666
```
6767

6868
This command will deploy the contract to `testnet` and sets its owner to the wallet with the provided `mnemonic`.
6969
Note that you have to populate the `--mnemonic` flag with the seedphrase for a valid Terra wallet with some LUNA for the specified network.
7070

7171
If successful, the output should look like:
7272
```
73-
Storing WASM: ../artifacts/example_terra_contract.wasm (183749 bytes)
73+
Storing WASM: ../artifacts/example_cw_contract.wasm (183749 bytes)
7474
Deploy fee: 44682uluna
7575
Code ID: 53199
7676
Instantiating a contract
@@ -93,14 +93,14 @@ npm run query -- --network testnet --contract <contract address>
9393
You can also migrate an existing contract by passing the `--migrate --contract terra123456xyzqwe..` arguments to the deploy command:
9494

9595
``` sh
96-
npm run deploy -- --network testnet --artifact ../artifacts/example_terra_contract.wasm --mnemonic "..." --migrate --contract "terra123..."
96+
npm run deploy -- --network testnet --artifact ../artifacts/example_cw_contract.wasm --mnemonic "..." --migrate --contract "terra123..."
9797
```
9898

9999
This command will replace the code for the given contract with the specified WASM artifact.
100100
If successful, the output should look like:
101101

102102
```
103-
Storing WASM: ../artifacts/example_terra_contract.wasm (183749 bytes)
103+
Storing WASM: ../artifacts/example_cw_contract.wasm (183749 bytes)
104104
Deploy fee: 44682uluna
105105
Code ID: 53227
106106
Sleeping for 10 seconds for store transaction to finalize.
@@ -111,6 +111,6 @@ Contract terra123456789yelw23uh22nadqlyjvtl7s5527er97 code_id successfully updat
111111
### Troubleshooting
112112

113113
When deploying the contract, you may encounter gateway timeout or account sequence mismatch errors.
114-
If this happens, check terra finder to determine if your transaction succeeded -- sometimes transactions succeed despite timing out.
114+
If this happens, check Terra Finder to determine if your transaction succeeded -- sometimes transactions succeed despite timing out.
115115
Note that the deployment script submits multiple transactions.
116116
If any of them fails, simply rerun the entire script; there is no problem re-running the successful transactions.

examples/cw-contract/examples/schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use cosmwasm_schema::{
77
schema_for,
88
};
99

10-
use example_terra_contract::msg::{
10+
use example_cw_contract::msg::{
1111
ExecuteMsg,
1212
FetchPriceResponse,
1313
InstantiateMsg,
1414
QueryMsg,
1515
};
16-
use example_terra_contract::state::State;
16+
use example_cw_contract::state::State;
1717

1818
fn main() {
1919
let mut out_dir = current_dir().unwrap();

examples/cw-contract/src/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use pyth_sdk_cw::PriceIdentifier;
1010

1111
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1212
pub struct State {
13-
// Available price feeds and their ids are listed in pyth-sdk-terra Readme.
13+
// Available price feeds and their ids are listed in pyth-sdk-cw Readme.
1414
pub price_feed_id: PriceIdentifier,
15-
// Contract address of Pyth in different networks are listed in pyth-sdk-terra Readme.
15+
// Contract address of Pyth in different networks are listed in pyth-sdk-cw Readme.
1616
pub pyth_contract_addr: Addr,
1717
}
1818

pyth-sdk-cw/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "Apache-2.0"
77
homepage = "https://pyth.network"
88
repository = "https://github.com/pyth-network/pyth-sdk-rs"
99
description = "pyth price oracle data structures and example usage"
10-
keywords = [ "pyth", "terra", "oracle" ]
10+
keywords = [ "pyth", "cw", "cosmwasm", "oracle" ]
1111
readme = "README.md"
1212

1313
[dependencies]

pyth-sdk-cw/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pyth Network CosmWasm SDK
22

33
This crate provides utilities for reading price feeds from the [pyth.network](https://pyth.network/) oracle on the CosmWasm ecosystem.
4-
It also includes an [example contract](../examples/terra-contract/) demonstrating how to read price feeds from on-chain CosmWasm applications.
4+
It also includes an [example contract](../examples/cw-contract/) demonstrating how to read price feeds from on-chain CosmWasm applications.
55

66
## Installation
77

pyth-sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pyth Network Common Rust SDK
22

33
This crate contains Pyth Network data structures that are shared across all Rust-based consumers of Pyth Network data.
4-
This crate is typically used in combination with a platform-specific crate such as [pyth-sdk-solana](../pyth-sdk-solana) or [pyth-sdk-terra](../pyth-sdk-terra).
4+
This crate is typically used in combination with a platform-specific crate such as [pyth-sdk-solana](../pyth-sdk-solana) or [pyth-sdk-cw](../pyth-sdk-cw).
55

66
## Usage
77

0 commit comments

Comments
 (0)