Skip to content

Commit

Permalink
Propagate rename to other package usages
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m committed Jan 24, 2024
1 parent 48926e6 commit b2147e0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion contract_manager/src/contracts/sui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
private client: SuiPythClient;

/**
* Given the ids of the pyth state and wormhole state, create a new SuiContract
* Given the ids of the pyth state and wormhole state, create a new SuiPriceFeedContract
* The package ids are derived based on the state ids
*
* @param chain the chain which this contract is deployed on
Expand Down
4 changes: 2 additions & 2 deletions target_chains/cosmwasm/deploy-scripts/src/instantiate-pyth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sha256 } from "@cosmjs/crypto";
import { getPythConfig } from "./configs";
import {
CosmWasmChain,
CosmWasmContract,
CosmWasmPriceFeedContract,
DefaultStore,
Store,
toPrivateKey,
Expand Down Expand Up @@ -96,7 +96,7 @@ async function run() {
});
console.log(`Contract admin set to ${address}`);

const contract = new CosmWasmContract(chain, address);
const contract = new CosmWasmPriceFeedContract(chain, address);
DefaultStore.contracts[contract.getId()] = contract;
DefaultStore.saveAllContracts();
console.log("Added the following to your CosmWasm contracts configs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { hideBin } from "yargs/helpers";
import { getWormholeConfig } from "./configs";
import {
CosmWasmChain,
CosmWasmContract,
CosmWasmPriceFeedContract,
DefaultStore,
toPrivateKey,
WormholeCosmWasmContract,
Expand Down Expand Up @@ -47,7 +47,7 @@ async function run() {
throw new Error(`Chain ${argv.chain} not found or not a CosmWasmChain`);
}
const privateKey = toPrivateKey(argv["private-key"]);
const storeCodeRes = await CosmWasmContract.storeCode(
const storeCodeRes = await CosmWasmPriceFeedContract.storeCode(
chain,
privateKey,
wasmFilePath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
EvmContract,
EvmPriceFeedContract,
DefaultStore,
Store,
getDefaultDeploymentConfig,
Expand Down Expand Up @@ -47,7 +47,7 @@ function getDefaultConfig(_chainName) {
}
function saveConfig(chainName, address) {
const chain = DefaultStore.chains[chainName];
const contract = new EvmContract(chain, address);
const contract = new EvmPriceFeedContract(chain, address);
DefaultStore.contracts[contract.getId()] = contract;
DefaultStore.saveAllContracts();
console.log("Added the following to your evm contract configs");
Expand Down
8 changes: 4 additions & 4 deletions target_chains/sui/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DefaultStore,
getDefaultDeploymentConfig,
SuiChain,
SuiContract,
SuiPriceFeedContract,
} from "contract_manager";
import { PriceServiceConnection } from "@pythnetwork/price-service-client";
import { execSync } from "child_process";
Expand Down Expand Up @@ -49,16 +49,16 @@ const OPTIONS = {
},
} as const;

function getContract(contractId: string): SuiContract {
const contract = DefaultStore.contracts[contractId] as SuiContract;
function getContract(contractId: string): SuiPriceFeedContract {
const contract = DefaultStore.contracts[contractId] as SuiPriceFeedContract;
if (!contract) {
throw new Error(`Contract ${contractId} not found`);
}
return contract;
}

function getPriceService(
contract: SuiContract,
contract: SuiPriceFeedContract,
endpointOverride: string | undefined
): PriceServiceConnection {
const defaultEndpoint = contract.getChain().isMainnet()
Expand Down
6 changes: 3 additions & 3 deletions target_chains/sui/cli/src/upgrade_pyth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TransactionBlock,
} from "@mysten/sui.js";
import { execSync } from "child_process";
import { SuiContract } from "contract_manager";
import { SuiPriceFeedContract } from "contract_manager";

export function buildForBytecodeAndDigest(packagePath: string) {
const buildOutput: {
Expand All @@ -33,7 +33,7 @@ export async function upgradePyth(
modules: number[][],
dependencies: string[],
signedVaa: Buffer,
contract: SuiContract
contract: SuiPriceFeedContract
) {
const pythPackage = await contract.getPackageId(contract.stateId);

Expand Down Expand Up @@ -78,7 +78,7 @@ export async function upgradePyth(
export async function migratePyth(
signer: RawSigner,
signedUpgradeVaa: Buffer,
contract: SuiContract,
contract: SuiPriceFeedContract,
pythPackageOld: string
) {
const pythPackage = await contract.getPackageId(contract.stateId);
Expand Down

0 comments on commit b2147e0

Please sign in to comment.