Browse Source

Entropy support in contract manager (#1242)

* Rename contracts to PriceFeedContracts

* Initial version of EvmEntropyContract
Amin Moghaddam 1 year ago
parent
commit
eef8468a22

+ 1 - 0
contract_manager/package.json

@@ -24,6 +24,7 @@
     "@injectivelabs/networks": "1.0.68",
     "@injectivelabs/networks": "1.0.68",
     "@mysten/sui.js": "^0.37.1",
     "@mysten/sui.js": "^0.37.1",
     "@pythnetwork/cosmwasm-deploy-tools": "*",
     "@pythnetwork/cosmwasm-deploy-tools": "*",
+    "@pythnetwork/entropy-sdk-solidity": "*",
     "@pythnetwork/price-service-client": "*",
     "@pythnetwork/price-service-client": "*",
     "@pythnetwork/pyth-sui-js": "*",
     "@pythnetwork/pyth-sui-js": "*",
     "aptos": "^1.5.0",
     "aptos": "^1.5.0",

+ 7 - 4
contract_manager/scripts/check_proposal.ts

@@ -18,7 +18,10 @@ import {
 } from "@pythnetwork/client/lib/cluster";
 } from "@pythnetwork/client/lib/cluster";
 import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
 import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
 import { AccountMeta, Keypair, PublicKey } from "@solana/web3.js";
 import { AccountMeta, Keypair, PublicKey } from "@solana/web3.js";
-import { EvmContract, WormholeEvmContract } from "../src/contracts/evm";
+import {
+  EvmPriceFeedContract,
+  WormholeEvmContract,
+} from "../src/contracts/evm";
 import Web3 from "web3";
 import Web3 from "web3";
 
 
 const parser = yargs(hideBin(process.argv))
 const parser = yargs(hideBin(process.argv))
@@ -71,11 +74,11 @@ async function main() {
             const currentIndex = await contract.getCurrentGuardianSetIndex();
             const currentIndex = await contract.getCurrentGuardianSetIndex();
             const guardianSet = await contract.getGuardianSet();
             const guardianSet = await contract.getGuardianSet();
 
 
-            const proxyContract = new EvmContract(chain, address);
+            const proxyContract = new EvmPriceFeedContract(chain, address);
             const proxyCode = await proxyContract.getCode();
             const proxyCode = await proxyContract.getCode();
             const receiverImplementation =
             const receiverImplementation =
               await proxyContract.getImplementationAddress();
               await proxyContract.getImplementationAddress();
-            const implementationCode = await new EvmContract(
+            const implementationCode = await new EvmPriceFeedContract(
               chain,
               chain,
               receiverImplementation
               receiverImplementation
             ).getCode();
             ).getCode();
@@ -103,7 +106,7 @@ async function main() {
               instruction.governanceAction.targetChainId
               instruction.governanceAction.targetChainId
           ) {
           ) {
             const address = instruction.governanceAction.address;
             const address = instruction.governanceAction.address;
-            const contract = new EvmContract(chain, address);
+            const contract = new EvmPriceFeedContract(chain, address);
             const code = await contract.getCodeDigestWithoutAddress();
             const code = await contract.getCodeDigestWithoutAddress();
             // this should be the same keccak256 of the deployedCode property generated by truffle
             // this should be the same keccak256 of the deployedCode property generated by truffle
             console.log(`${chain.getId()}  Address:${address} digest:${code}`);
             console.log(`${chain.getId()}  Address:${address} digest:${code}`);

+ 2 - 2
contract_manager/scripts/deploy_cosmwasm.ts

@@ -1,7 +1,7 @@
 import yargs from "yargs";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 import { hideBin } from "yargs/helpers";
 import { CosmWasmChain } from "../src/chains";
 import { CosmWasmChain } from "../src/chains";
-import { CosmWasmContract } from "../src/contracts/cosmwasm";
+import { CosmWasmPriceFeedContract } from "../src/contracts/cosmwasm";
 import { DefaultStore } from "../src/store";
 import { DefaultStore } from "../src/store";
 
 
 const parser = yargs(hideBin(process.argv))
 const parser = yargs(hideBin(process.argv))
@@ -36,7 +36,7 @@ async function main() {
   const argv = await parser.argv;
   const argv = await parser.argv;
   const { code, wormholeContract } = argv;
   const { code, wormholeContract } = argv;
   console.log(
   console.log(
-    await CosmWasmContract.deploy(
+    await CosmWasmPriceFeedContract.deploy(
       DefaultStore.chains[argv.chain] as CosmWasmChain,
       DefaultStore.chains[argv.chain] as CosmWasmChain,
       wormholeContract,
       wormholeContract,
       argv["private-key"],
       argv["private-key"],

+ 6 - 6
contract_manager/scripts/fetch_fees.ts

@@ -1,10 +1,10 @@
 import yargs from "yargs";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 import { hideBin } from "yargs/helpers";
 import {
 import {
-  AptosContract,
-  CosmWasmContract,
+  AptosPriceFeedContract,
+  CosmWasmPriceFeedContract,
   DefaultStore,
   DefaultStore,
-  EvmContract,
+  EvmPriceFeedContract,
 } from "../src";
 } from "../src";
 
 
 const parser = yargs(hideBin(process.argv))
 const parser = yargs(hideBin(process.argv))
@@ -22,9 +22,9 @@ async function main() {
   for (const contract of Object.values(DefaultStore.contracts)) {
   for (const contract of Object.values(DefaultStore.contracts)) {
     if (contract.getChain().isMainnet() === argv.testnet) continue;
     if (contract.getChain().isMainnet() === argv.testnet) continue;
     if (
     if (
-      contract instanceof AptosContract ||
-      contract instanceof EvmContract ||
-      contract instanceof CosmWasmContract
+      contract instanceof AptosPriceFeedContract ||
+      contract instanceof EvmPriceFeedContract ||
+      contract instanceof CosmWasmPriceFeedContract
     ) {
     ) {
       try {
       try {
         console.log(`${contract.getId()} ${await contract.getTotalFee()}`);
         console.log(`${contract.getId()} ${await contract.getTotalFee()}`);

+ 5 - 4
contract_manager/scripts/list_evm_contracts.ts

@@ -1,10 +1,10 @@
 import yargs from "yargs";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 import { hideBin } from "yargs/helpers";
 import {
 import {
-  AptosContract,
-  CosmWasmContract,
+  AptosPriceFeedContract,
+  CosmWasmPriceFeedContract,
   DefaultStore,
   DefaultStore,
-  EvmContract,
+  EvmPriceFeedContract,
 } from "../src";
 } from "../src";
 
 
 const parser = yargs(hideBin(process.argv))
 const parser = yargs(hideBin(process.argv))
@@ -22,7 +22,8 @@ async function main() {
   const entries = [];
   const entries = [];
   for (const contract of Object.values(DefaultStore.contracts)) {
   for (const contract of Object.values(DefaultStore.contracts)) {
     if (contract.getChain().isMainnet() === argv.testnet) continue;
     if (contract.getChain().isMainnet() === argv.testnet) continue;
-    if (contract instanceof EvmContract) {
+    if (contract instanceof EvmPriceFeedContract) {
+      let wormholeContract = await contract.getWormholeContract();
       try {
       try {
         const version = await contract.getVersion();
         const version = await contract.getVersion();
         entries.push({
         entries.push({

+ 2 - 2
contract_manager/scripts/upload_cosmwasm.ts

@@ -1,7 +1,7 @@
 import yargs from "yargs";
 import yargs from "yargs";
 import { hideBin } from "yargs/helpers";
 import { hideBin } from "yargs/helpers";
 import { CosmWasmChain } from "../src/chains";
 import { CosmWasmChain } from "../src/chains";
-import { CosmWasmContract } from "../src/contracts/cosmwasm";
+import { CosmWasmPriceFeedContract } from "../src/contracts/cosmwasm";
 import { DefaultStore } from "../src/store";
 import { DefaultStore } from "../src/store";
 import { toPrivateKey } from "../src";
 import { toPrivateKey } from "../src";
 
 
@@ -30,7 +30,7 @@ const parser = yargs(hideBin(process.argv))
 async function main() {
 async function main() {
   const argv = await parser.argv;
   const argv = await parser.argv;
   const { code } = argv;
   const { code } = argv;
-  const { codeId } = await CosmWasmContract.storeCode(
+  const { codeId } = await CosmWasmPriceFeedContract.storeCode(
     DefaultStore.chains[argv.chain] as CosmWasmChain,
     DefaultStore.chains[argv.chain] as CosmWasmChain,
     toPrivateKey(argv["private-key"]),
     toPrivateKey(argv["private-key"]),
     code
     code

+ 1 - 1
contract_manager/src/base.ts

@@ -50,7 +50,7 @@ export interface PriceFeed {
   emaPrice: Price;
   emaPrice: Price;
 }
 }
 
 
-export abstract class Contract extends Storable {
+export abstract class PriceFeedContract extends Storable {
   /**
   /**
    * Returns the time period in seconds that stale data is considered valid for.
    * Returns the time period in seconds that stale data is considered valid for.
    */
    */

+ 13 - 8
contract_manager/src/contracts/aptos.ts

@@ -1,4 +1,4 @@
-import { Contract, PriceFeed, PrivateKey, TxResult } from "../base";
+import { PriceFeedContract, PriceFeed, PrivateKey, TxResult } from "../base";
 import { ApiError, BCS, CoinClient, TxnBuilderTypes } from "aptos";
 import { ApiError, BCS, CoinClient, TxnBuilderTypes } from "aptos";
 import { AptosChain, Chain } from "../chains";
 import { AptosChain, Chain } from "../chains";
 import { DataSource } from "xc_admin_common";
 import { DataSource } from "xc_admin_common";
@@ -70,8 +70,8 @@ export class WormholeAptosContract extends WormholeContract {
   }
   }
 }
 }
 
 
-export class AptosContract extends Contract {
-  static type = "AptosContract";
+export class AptosPriceFeedContract extends PriceFeedContract {
+  static type = "AptosPriceFeedContract";
 
 
   /**
   /**
    * Given the ids of the pyth state and wormhole state, create a new AptosContract
    * Given the ids of the pyth state and wormhole state, create a new AptosContract
@@ -92,11 +92,16 @@ export class AptosContract extends Contract {
   static fromJson(
   static fromJson(
     chain: Chain,
     chain: Chain,
     parsed: { type: string; stateId: string; wormholeStateId: string }
     parsed: { type: string; stateId: string; wormholeStateId: string }
-  ): AptosContract {
-    if (parsed.type !== AptosContract.type) throw new Error("Invalid type");
+  ): AptosPriceFeedContract {
+    if (parsed.type !== AptosPriceFeedContract.type)
+      throw new Error("Invalid type");
     if (!(chain instanceof AptosChain))
     if (!(chain instanceof AptosChain))
       throw new Error(`Wrong chain type ${chain}`);
       throw new Error(`Wrong chain type ${chain}`);
-    return new AptosContract(chain, parsed.stateId, parsed.wormholeStateId);
+    return new AptosPriceFeedContract(
+      chain,
+      parsed.stateId,
+      parsed.wormholeStateId
+    );
   }
   }
 
 
   async executeGovernanceInstruction(
   async executeGovernanceInstruction(
@@ -252,7 +257,7 @@ export class AptosContract extends Contract {
   }
   }
 
 
   getType(): string {
   getType(): string {
-    return AptosContract.type;
+    return AptosPriceFeedContract.type;
   }
   }
 
 
   async getTotalFee(): Promise<bigint> {
   async getTotalFee(): Promise<bigint> {
@@ -272,7 +277,7 @@ export class AptosContract extends Contract {
       chain: this.chain.getId(),
       chain: this.chain.getId(),
       stateId: this.stateId,
       stateId: this.stateId,
       wormholeStateId: this.wormholeStateId,
       wormholeStateId: this.wormholeStateId,
-      type: AptosContract.type,
+      type: AptosPriceFeedContract.type,
     };
     };
   }
   }
 }
 }

+ 11 - 11
contract_manager/src/contracts/cosmwasm.ts

@@ -11,7 +11,7 @@ import { Coin } from "@cosmjs/stargate";
 import { DataSource } from "xc_admin_common";
 import { DataSource } from "xc_admin_common";
 import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
 import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
 import {
 import {
-  Contract,
+  PriceFeedContract,
   getDefaultDeploymentConfig,
   getDefaultDeploymentConfig,
   PrivateKey,
   PrivateKey,
   TxResult,
   TxResult,
@@ -89,7 +89,8 @@ export class WormholeCosmWasmContract extends WormholeContract {
   }
   }
 }
 }
 
 
-export class CosmWasmContract extends Contract {
+export class CosmWasmPriceFeedContract extends PriceFeedContract {
+  static type = "CosmWasmPriceFeedContract";
   async getDataSources(): Promise<DataSource[]> {
   async getDataSources(): Promise<DataSource[]> {
     const config = await this.getConfig();
     const config = await this.getConfig();
     return config.config_v1.data_sources.map(
     return config.config_v1.data_sources.map(
@@ -112,8 +113,6 @@ export class CosmWasmContract extends Contract {
     };
     };
   }
   }
 
 
-  static type = "CosmWasmContract";
-
   constructor(public chain: CosmWasmChain, public address: string) {
   constructor(public chain: CosmWasmChain, public address: string) {
     super();
     super();
   }
   }
@@ -121,15 +120,16 @@ export class CosmWasmContract extends Contract {
   static fromJson(
   static fromJson(
     chain: Chain,
     chain: Chain,
     parsed: { type: string; address: string }
     parsed: { type: string; address: string }
-  ): CosmWasmContract {
-    if (parsed.type !== CosmWasmContract.type) throw new Error("Invalid type");
+  ): CosmWasmPriceFeedContract {
+    if (parsed.type !== CosmWasmPriceFeedContract.type)
+      throw new Error("Invalid type");
     if (!(chain instanceof CosmWasmChain))
     if (!(chain instanceof CosmWasmChain))
       throw new Error(`Wrong chain type ${chain}`);
       throw new Error(`Wrong chain type ${chain}`);
-    return new CosmWasmContract(chain, parsed.address);
+    return new CosmWasmPriceFeedContract(chain, parsed.address);
   }
   }
 
 
   getType(): string {
   getType(): string {
-    return CosmWasmContract.type;
+    return CosmWasmPriceFeedContract.type;
   }
   }
 
 
   /**
   /**
@@ -161,7 +161,7 @@ export class CosmWasmContract extends Contract {
     codeId: number,
     codeId: number,
     config: DeploymentConfig,
     config: DeploymentConfig,
     privateKey: PrivateKey
     privateKey: PrivateKey
-  ): Promise<CosmWasmContract> {
+  ): Promise<CosmWasmPriceFeedContract> {
     const executor = await chain.getExecutor(privateKey);
     const executor = await chain.getExecutor(privateKey);
     const result = await executor.instantiateContract({
     const result = await executor.instantiateContract({
       codeId: codeId,
       codeId: codeId,
@@ -172,7 +172,7 @@ export class CosmWasmContract extends Contract {
       newAdminAddr: result.contractAddr,
       newAdminAddr: result.contractAddr,
       contractAddr: result.contractAddr,
       contractAddr: result.contractAddr,
     });
     });
-    return new CosmWasmContract(chain, result.contractAddr);
+    return new CosmWasmPriceFeedContract(chain, result.contractAddr);
   }
   }
 
 
   getId(): string {
   getId(): string {
@@ -183,7 +183,7 @@ export class CosmWasmContract extends Contract {
     return {
     return {
       chain: this.chain.getId(),
       chain: this.chain.getId(),
       address: this.address,
       address: this.address,
-      type: CosmWasmContract.type,
+      type: CosmWasmPriceFeedContract.type,
     };
     };
   }
   }
 
 

+ 73 - 8
contract_manager/src/contracts/evm.ts

@@ -1,6 +1,7 @@
 import Web3 from "web3";
 import Web3 from "web3";
 import PythInterfaceAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json";
 import PythInterfaceAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json";
-import { Contract, PrivateKey } from "../base";
+import EntropyAbi from "@pythnetwork/entropy-sdk-solidity/abis/IEntropy.json";
+import { PriceFeedContract, PrivateKey, Storable } from "../base";
 import { Chain, EvmChain } from "../chains";
 import { Chain, EvmChain } from "../chains";
 import { DataSource } from "xc_admin_common";
 import { DataSource } from "xc_admin_common";
 import { WormholeContract } from "./wormhole";
 import { WormholeContract } from "./wormhole";
@@ -281,8 +282,71 @@ export class WormholeEvmContract extends WormholeContract {
   }
   }
 }
 }
 
 
-export class EvmContract extends Contract {
-  static type = "EvmContract";
+interface EntropyProviderInfo {
+  feeInWei: string;
+  accruedFeesInWei: string;
+  originalCommitment: string;
+  originalCommitmentSequenceNumber: string;
+  commitmentMetadata: string;
+  uri: string;
+  endSequenceNumber: string;
+  sequenceNumber: string;
+  currentCommitment: string;
+  currentCommitmentSequenceNumber: string;
+}
+
+export class EvmEntropyContract extends Storable {
+  static type = "EvmEntropyContract";
+
+  constructor(public chain: EvmChain, public address: string) {
+    super();
+  }
+
+  getId(): string {
+    return `${this.chain.getId()}_${this.address}`;
+  }
+
+  getType(): string {
+    return EvmEntropyContract.type;
+  }
+
+  static fromJson(
+    chain: Chain,
+    parsed: { type: string; address: string }
+  ): EvmEntropyContract {
+    if (parsed.type !== EvmEntropyContract.type)
+      throw new Error("Invalid type");
+    if (!(chain instanceof EvmChain))
+      throw new Error(`Wrong chain type ${chain}`);
+    return new EvmEntropyContract(chain, parsed.address);
+  }
+
+  toJson() {
+    return {
+      chain: this.chain.getId(),
+      address: this.address,
+      type: EvmPriceFeedContract.type,
+    };
+  }
+
+  getContract() {
+    const web3 = new Web3(this.chain.getRpcUrl());
+    return new web3.eth.Contract(EntropyAbi as any, this.address); // eslint-disable-line  @typescript-eslint/no-explicit-any
+  }
+
+  async getDefaultProvider(): Promise<string> {
+    const contract = this.getContract();
+    return await contract.methods.getDefaultProvider().call();
+  }
+
+  async getProviderInfo(address: string): Promise<EntropyProviderInfo> {
+    const contract = this.getContract();
+    return await contract.methods.getProviderInfo(address).call();
+  }
+}
+
+export class EvmPriceFeedContract extends PriceFeedContract {
+  static type = "EvmPriceFeedContract";
 
 
   constructor(public chain: EvmChain, public address: string) {
   constructor(public chain: EvmChain, public address: string) {
     super();
     super();
@@ -291,11 +355,12 @@ export class EvmContract extends Contract {
   static fromJson(
   static fromJson(
     chain: Chain,
     chain: Chain,
     parsed: { type: string; address: string }
     parsed: { type: string; address: string }
-  ): EvmContract {
-    if (parsed.type !== EvmContract.type) throw new Error("Invalid type");
+  ): EvmPriceFeedContract {
+    if (parsed.type !== EvmPriceFeedContract.type)
+      throw new Error("Invalid type");
     if (!(chain instanceof EvmChain))
     if (!(chain instanceof EvmChain))
       throw new Error(`Wrong chain type ${chain}`);
       throw new Error(`Wrong chain type ${chain}`);
-    return new EvmContract(chain, parsed.address);
+    return new EvmPriceFeedContract(chain, parsed.address);
   }
   }
 
 
   getId(): string {
   getId(): string {
@@ -303,7 +368,7 @@ export class EvmContract extends Contract {
   }
   }
 
 
   getType(): string {
   getType(): string {
-    return EvmContract.type;
+    return EvmPriceFeedContract.type;
   }
   }
 
 
   async getVersion(): Promise<string> {
   async getVersion(): Promise<string> {
@@ -496,7 +561,7 @@ export class EvmContract extends Contract {
     return {
     return {
       chain: this.chain.getId(),
       chain: this.chain.getId(),
       address: this.address,
       address: this.address,
-      type: EvmContract.type,
+      type: EvmPriceFeedContract.type,
     };
     };
   }
   }
 }
 }

+ 14 - 9
contract_manager/src/contracts/sui.ts

@@ -7,15 +7,15 @@ import {
 } from "@mysten/sui.js";
 } from "@mysten/sui.js";
 import { Chain, SuiChain } from "../chains";
 import { Chain, SuiChain } from "../chains";
 import { DataSource } from "xc_admin_common";
 import { DataSource } from "xc_admin_common";
-import { Contract, PrivateKey, TxResult } from "../base";
+import { PriceFeedContract, PrivateKey, TxResult } from "../base";
 import { SuiPythClient } from "@pythnetwork/pyth-sui-js";
 import { SuiPythClient } from "@pythnetwork/pyth-sui-js";
 
 
-export class SuiContract extends Contract {
-  static type = "SuiContract";
+export class SuiPriceFeedContract extends PriceFeedContract {
+  static type = "SuiPriceFeedContract";
   private client: SuiPythClient;
   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
    * The package ids are derived based on the state ids
    *
    *
    * @param chain the chain which this contract is deployed on
    * @param chain the chain which this contract is deployed on
@@ -38,15 +38,20 @@ export class SuiContract extends Contract {
   static fromJson(
   static fromJson(
     chain: Chain,
     chain: Chain,
     parsed: { type: string; stateId: string; wormholeStateId: string }
     parsed: { type: string; stateId: string; wormholeStateId: string }
-  ): SuiContract {
-    if (parsed.type !== SuiContract.type) throw new Error("Invalid type");
+  ): SuiPriceFeedContract {
+    if (parsed.type !== SuiPriceFeedContract.type)
+      throw new Error("Invalid type");
     if (!(chain instanceof SuiChain))
     if (!(chain instanceof SuiChain))
       throw new Error(`Wrong chain type ${chain}`);
       throw new Error(`Wrong chain type ${chain}`);
-    return new SuiContract(chain, parsed.stateId, parsed.wormholeStateId);
+    return new SuiPriceFeedContract(
+      chain,
+      parsed.stateId,
+      parsed.wormholeStateId
+    );
   }
   }
 
 
   getType(): string {
   getType(): string {
-    return SuiContract.type;
+    return SuiPriceFeedContract.type;
   }
   }
 
 
   getChain(): SuiChain {
   getChain(): SuiChain {
@@ -58,7 +63,7 @@ export class SuiContract extends Contract {
       chain: this.chain.getId(),
       chain: this.chain.getId(),
       stateId: this.stateId,
       stateId: this.stateId,
       wormholeStateId: this.wormholeStateId,
       wormholeStateId: this.wormholeStateId,
-      type: SuiContract.type,
+      type: SuiPriceFeedContract.type,
     };
     };
   }
   }
 
 

+ 4 - 4
contract_manager/src/shell.ts

@@ -7,10 +7,10 @@ repl.start();
 repl.evalCode(
 repl.evalCode(
   "import { loadHotWallet, Vault } from './src/governance';" +
   "import { loadHotWallet, Vault } from './src/governance';" +
     "import { SuiChain, CosmWasmChain, AptosChain, EvmChain } from './src/chains';" +
     "import { SuiChain, CosmWasmChain, AptosChain, EvmChain } from './src/chains';" +
-    "import { SuiContract } from './src/contracts/sui';" +
-    "import { WormholeCosmWasmContract, CosmWasmContract } from './src/contracts/cosmwasm';" +
-    "import { WormholeEvmContract, EvmContract } from './src/contracts/evm';" +
-    "import { WormholeAptosContract, AptosContract } from './src/contracts/aptos';" +
+    "import { SuiPriceFeedContract } from './src/contracts/sui';" +
+    "import { WormholeCosmWasmContract, CosmWasmPriceFeedContract } from './src/contracts/cosmwasm';" +
+    "import { WormholeEvmContract, EvmPriceFeedContract } from './src/contracts/evm';" +
+    "import { WormholeAptosContract, AptosPriceFeedContract } from './src/contracts/aptos';" +
     "import { DefaultStore } from './src/store';" +
     "import { DefaultStore } from './src/store';" +
     "import { toPrivateKey } from './src/base';" +
     "import { toPrivateKey } from './src/base';" +
     "DefaultStore"
     "DefaultStore"

+ 24 - 14
contract_manager/src/store.ts

@@ -7,19 +7,21 @@ import {
   SuiChain,
   SuiChain,
 } from "./chains";
 } from "./chains";
 import {
 import {
-  AptosContract,
-  CosmWasmContract,
-  EvmContract,
-  SuiContract,
+  AptosPriceFeedContract,
+  CosmWasmPriceFeedContract,
+  EvmEntropyContract,
+  EvmPriceFeedContract,
+  SuiPriceFeedContract,
 } from "./contracts";
 } from "./contracts";
-import { Contract } from "./base";
+import { PriceFeedContract } from "./base";
 import { parse, stringify } from "yaml";
 import { parse, stringify } from "yaml";
 import { readdirSync, readFileSync, statSync, writeFileSync } from "fs";
 import { readdirSync, readFileSync, statSync, writeFileSync } from "fs";
 import { Vault } from "./governance";
 import { Vault } from "./governance";
 
 
 export class Store {
 export class Store {
   public chains: Record<string, Chain> = { global: new GlobalChain() };
   public chains: Record<string, Chain> = { global: new GlobalChain() };
-  public contracts: Record<string, Contract> = {};
+  public contracts: Record<string, PriceFeedContract> = {};
+  public entropy_contracts: Record<string, EvmEntropyContract> = {};
   public vaults: Record<string, Vault> = {};
   public vaults: Record<string, Vault> = {};
 
 
   constructor(public path: string) {
   constructor(public path: string) {
@@ -28,7 +30,7 @@ export class Store {
     this.loadAllVaults();
     this.loadAllVaults();
   }
   }
 
 
-  static serialize(obj: Contract | Chain | Vault) {
+  static serialize(obj: PriceFeedContract | Chain | Vault) {
     return stringify([obj.toJson()]);
     return stringify([obj.toJson()]);
   }
   }
 
 
@@ -73,7 +75,7 @@ export class Store {
   }
   }
 
 
   saveAllContracts() {
   saveAllContracts() {
-    const contractsByType: Record<string, Contract[]> = {};
+    const contractsByType: Record<string, PriceFeedContract[]> = {};
     for (const contract of Object.values(this.contracts)) {
     for (const contract of Object.values(this.contracts)) {
       if (!contractsByType[contract.getType()]) {
       if (!contractsByType[contract.getType()]) {
         contractsByType[contract.getType()] = [];
         contractsByType[contract.getType()] = [];
@@ -106,10 +108,11 @@ export class Store {
 
 
   loadAllContracts() {
   loadAllContracts() {
     const allContractClasses = {
     const allContractClasses = {
-      [CosmWasmContract.type]: CosmWasmContract,
-      [SuiContract.type]: SuiContract,
-      [EvmContract.type]: EvmContract,
-      [AptosContract.type]: AptosContract,
+      [CosmWasmPriceFeedContract.type]: CosmWasmPriceFeedContract,
+      [SuiPriceFeedContract.type]: SuiPriceFeedContract,
+      [EvmPriceFeedContract.type]: EvmPriceFeedContract,
+      [AptosPriceFeedContract.type]: AptosPriceFeedContract,
+      [EvmEntropyContract.type]: EvmEntropyContract,
     };
     };
     this.getYamlFiles(`${this.path}/contracts/`).forEach((yamlFile) => {
     this.getYamlFiles(`${this.path}/contracts/`).forEach((yamlFile) => {
       const parsedArray = parse(readFileSync(yamlFile, "utf-8"));
       const parsedArray = parse(readFileSync(yamlFile, "utf-8"));
@@ -122,11 +125,18 @@ export class Store {
           chain,
           chain,
           parsed
           parsed
         );
         );
-        if (this.contracts[chainContract.getId()])
+        if (
+          this.contracts[chainContract.getId()] ||
+          this.entropy_contracts[chainContract.getId()]
+        )
           throw new Error(
           throw new Error(
             `Multiple contracts with id ${chainContract.getId()} found`
             `Multiple contracts with id ${chainContract.getId()} found`
           );
           );
-        this.contracts[chainContract.getId()] = chainContract;
+        if (chainContract instanceof EvmEntropyContract) {
+          this.entropy_contracts[chainContract.getId()] = chainContract;
+        } else {
+          this.contracts[chainContract.getId()] = chainContract;
+        }
       }
       }
     });
     });
   }
   }

+ 3 - 3
contract_manager/store/contracts/AptosContracts.yaml

@@ -1,12 +1,12 @@
 - chain: aptos_mainnet
 - chain: aptos_mainnet
   stateId: "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387"
   stateId: "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387"
   wormholeStateId: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625"
   wormholeStateId: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625"
-  type: AptosContract
+  type: AptosPriceFeedContract
 - chain: aptos_testnet
 - chain: aptos_testnet
   stateId: "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387"
   stateId: "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387"
   wormholeStateId: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625"
   wormholeStateId: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625"
-  type: AptosContract
+  type: AptosPriceFeedContract
 - chain: movement_move_devnet
 - chain: movement_move_devnet
   stateId: "0x9357e76fe965c9956a76181ee49f66d51b7f9c3800182a944ed96be86301e49f"
   stateId: "0x9357e76fe965c9956a76181ee49f66d51b7f9c3800182a944ed96be86301e49f"
   wormholeStateId: "0x9236893d6444b208b7e0b3e8d4be4ace90b6d17817ab7d1584e46a33ef5c50c9"
   wormholeStateId: "0x9236893d6444b208b7e0b3e8d4be4ace90b6d17817ab7d1584e46a33ef5c50c9"
-  type: AptosContract
+  type: AptosPriceFeedContract

+ 14 - 14
contract_manager/store/contracts/CosmWasmContracts.yaml

@@ -1,42 +1,42 @@
 - chain: injective_testnet
 - chain: injective_testnet
   address: inj18rlflp3735h25jmjx97d22c72sxk260amdjxlu
   address: inj18rlflp3735h25jmjx97d22c72sxk260amdjxlu
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: juno_testnet
 - chain: juno_testnet
   address: juno1eacsrua27njc35pxz37y97gmcjs899t59f8pf0rkejjyvtmhws5q6lxsdd
   address: juno1eacsrua27njc35pxz37y97gmcjs899t59f8pf0rkejjyvtmhws5q6lxsdd
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: sei_testnet_atlantic_2
 - chain: sei_testnet_atlantic_2
   address: sei1kpntez76v38yuxhhaaahdmvjxnr5tkr8tq077smefs7uw70rj5yqw2aewy
   address: sei1kpntez76v38yuxhhaaahdmvjxnr5tkr8tq077smefs7uw70rj5yqw2aewy
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: neutron_testnet_pion_1
 - chain: neutron_testnet_pion_1
   address: neutron15ldst8t80982akgr8w8ekcytejzkmfpgdkeq4xgtge48qs7435jqp87u3t
   address: neutron15ldst8t80982akgr8w8ekcytejzkmfpgdkeq4xgtge48qs7435jqp87u3t
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: osmosis
 - chain: osmosis
   address: osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7
   address: osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: injective
 - chain: injective
   address: inj12j43nf2f0qumnt2zrrmpvnsqgzndxefujlvr08
   address: inj12j43nf2f0qumnt2zrrmpvnsqgzndxefujlvr08
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: sei_testnet_atlantic_2
 - chain: sei_testnet_atlantic_2
   address: sei1w2rxq6eckak47s25crxlhmq96fzjwdtjgdwavn56ggc0qvxvw7rqczxyfy
   address: sei1w2rxq6eckak47s25crxlhmq96fzjwdtjgdwavn56ggc0qvxvw7rqczxyfy
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: sei_pacific_1
 - chain: sei_pacific_1
   address: sei15d2tyq2jzxmpg32y3am3w62dts32qgzmds9qnr6c87r0gwwr7ynqal0x38
   address: sei15d2tyq2jzxmpg32y3am3w62dts32qgzmds9qnr6c87r0gwwr7ynqal0x38
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: osmosis_testnet_5
 - chain: osmosis_testnet_5
   address: osmo1lltupx02sj99suakmuk4sr4ppqf34ajedaxut3ukjwkv6469erwqtpg9t3
   address: osmo1lltupx02sj99suakmuk4sr4ppqf34ajedaxut3ukjwkv6469erwqtpg9t3
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: osmosis_testnet_5
 - chain: osmosis_testnet_5
   address: osmo1hpdzqku55lmfmptpyj6wdlugqs5etr6teqf7r4yqjjrxjznjhtuqqu5kdh
   address: osmo1hpdzqku55lmfmptpyj6wdlugqs5etr6teqf7r4yqjjrxjznjhtuqqu5kdh
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: neutron
 - chain: neutron
   address: neutron1m2emc93m9gpwgsrsf2vylv9xvgqh654630v7dfrhrkmr5slly53spg85wv
   address: neutron1m2emc93m9gpwgsrsf2vylv9xvgqh654630v7dfrhrkmr5slly53spg85wv
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: injective_testnet
 - chain: injective_testnet
   address: inj18hckkzqf47mdhd734g6papk6wj20y24rm43sk9
   address: inj18hckkzqf47mdhd734g6papk6wj20y24rm43sk9
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: juno_testnet
 - chain: juno_testnet
   address: juno1h93q9kwlnfml2gum4zj54al9w4jdmuhtzrh6vhycnemsqlqv9l9snnznxs
   address: juno1h93q9kwlnfml2gum4zj54al9w4jdmuhtzrh6vhycnemsqlqv9l9snnznxs
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract
 - chain: neutron_testnet_pion_1
 - chain: neutron_testnet_pion_1
   address: neutron16zwrmx3zgggmxhzau86xfycm42cr4sj888hdvzsxya3qarp6zhhqzhlkvz
   address: neutron16zwrmx3zgggmxhzau86xfycm42cr4sj888hdvzsxya3qarp6zhhqzhlkvz
-  type: CosmWasmContract
+  type: CosmWasmPriceFeedContract

+ 87 - 84
contract_manager/store/contracts/EvmContracts.yaml

@@ -1,252 +1,255 @@
 - chain: evmos
 - chain: evmos
   address: "0x354bF866A4B006C9AF9d9e06d9364217A8616E12"
   address: "0x354bF866A4B006C9AF9d9e06d9364217A8616E12"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: ethereum
 - chain: ethereum
   address: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6"
   address: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: polygon
 - chain: polygon
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: aurora
 - chain: aurora
   address: "0xF89C7b475821EC3fDC2dC8099032c05c6c0c9AB9"
   address: "0xF89C7b475821EC3fDC2dC8099032c05c6c0c9AB9"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: fantom
 - chain: fantom
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: optimism
 - chain: optimism
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: arbitrum
 - chain: arbitrum
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: gnosis
 - chain: gnosis
   address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
   address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: polygon_zkevm
 - chain: polygon_zkevm
   address: "0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65"
   address: "0xC5E56d6b40F3e3B5fbfa266bCd35C37426537c65"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: conflux_espace
 - chain: conflux_espace
   address: "0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc"
   address: "0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: bsc
 - chain: bsc
   address: "0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594"
   address: "0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: kava
 - chain: kava
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: avalanche
 - chain: avalanche
   address: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6"
   address: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: canto
 - chain: canto
   address: "0x98046Bd286715D3B0BC227Dd7a956b83D8978603"
   address: "0x98046Bd286715D3B0BC227Dd7a956b83D8978603"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: linea
 - chain: linea
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: neon
 - chain: neon
   address: "0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5"
   address: "0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: mantle
 - chain: mantle
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: meter
 - chain: meter
   address: "0xbFe3f445653f2136b2FD1e6DdDb5676392E3AF16"
   address: "0xbFe3f445653f2136b2FD1e6DdDb5676392E3AF16"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: kcc
 - chain: kcc
   address: "0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B"
   address: "0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: eos
 - chain: eos
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: celo
 - chain: celo
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
   address: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: wemix
 - chain: wemix
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: base
 - chain: base
   address: "0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a"
   address: "0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: cronos
 - chain: cronos
   address: "0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B"
   address: "0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zksync
 - chain: zksync
   address: "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834"
   address: "0xf087c864AEccFb6A2Bf1Af6A0382B0d0f6c5D834"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: ronin
 - chain: ronin
   address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
   address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: horizen_eon
 - chain: horizen_eon
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: shimmer
 - chain: shimmer
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: boba
 - chain: boba
   address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
   address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: manta
 - chain: manta
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: scroll
 - chain: scroll
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: chiliz
 - chain: chiliz
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: coredao
 - chain: coredao
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: tomochain
 - chain: tomochain
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: base_goerli
 - chain: base_goerli
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: arbitrum_sepolia
 - chain: arbitrum_sepolia
   address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
   address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: fuji
 - chain: fuji
   address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509"
   address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: canto_testnet
 - chain: canto_testnet
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: polygon_zkevm_testnet
 - chain: polygon_zkevm_testnet
   address: "0xFf255f800044225f54Af4510332Aa3D67CC77635"
   address: "0xFf255f800044225f54Af4510332Aa3D67CC77635"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: aurora_testnet
 - chain: aurora_testnet
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: mantle_testnet
 - chain: mantle_testnet
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: chiado
 - chain: chiado
   address: "0x98046Bd286715D3B0BC227Dd7a956b83D8978603"
   address: "0x98046Bd286715D3B0BC227Dd7a956b83D8978603"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: kava_testnet
 - chain: kava_testnet
   address: "0xfA25E653b44586dBbe27eE9d252192F0e4956683"
   address: "0xfA25E653b44586dBbe27eE9d252192F0e4956683"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: conflux_espace_testnet
 - chain: conflux_espace_testnet
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: celo_alfajores_testnet
 - chain: celo_alfajores_testnet
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: bsc_testnet
 - chain: bsc_testnet
   address: "0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb"
   address: "0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: syndr_nitro_testnet
 - chain: syndr_nitro_testnet
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: kcc_testnet
 - chain: kcc_testnet
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: eos_testnet
 - chain: eos_testnet
   address: "0x0708325268dF9F66270F1401206434524814508b"
   address: "0x0708325268dF9F66270F1401206434524814508b"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: meter_testnet
 - chain: meter_testnet
   address: "0x5a71C07a0588074443545eE0c08fb0375564c3E4"
   address: "0x5a71C07a0588074443545eE0c08fb0375564c3E4"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: optimism_goerli
 - chain: optimism_goerli
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: shimmer_testnet
 - chain: shimmer_testnet
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: scroll_sepolia
 - chain: scroll_sepolia
   address: "0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c"
   address: "0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: saigon
 - chain: saigon
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
   address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: boba_goerli
 - chain: boba_goerli
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: manta_testnet
 - chain: manta_testnet
   address: "0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c"
   address: "0x41c9e39574F40Ad34c79f1C99B66A45eFB830d4c"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: chiliz_spicy
 - chain: chiliz_spicy
   address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509"
   address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: astar_testnet
 - chain: astar_testnet
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: coredao_testnet
 - chain: coredao_testnet
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
   address: "0x8D254a21b3C86D32F7179855531CE99164721933"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: tomochain_testnet
 - chain: tomochain_testnet
   address: "0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167"
   address: "0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: cronos_testnet
 - chain: cronos_testnet
   address: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320"
   address: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: wemix_testnet
 - chain: wemix_testnet
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: mumbai
 - chain: mumbai
   address: "0xFC6bd9F9f0c6481c6Af3A7Eb46b296A5B85ed379"
   address: "0xFC6bd9F9f0c6481c6Af3A7Eb46b296A5B85ed379"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: fantom_testnet
 - chain: fantom_testnet
   address: "0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb"
   address: "0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: sepolia
 - chain: sepolia
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
   address: "0x26DD80569a8B23768A1d80869Ed7339e07595E85"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: sepolia
 - chain: sepolia
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
   address: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: linea_goerli
 - chain: linea_goerli
   address: "0xdF21D137Aadc95588205586636710ca2890538d5"
   address: "0xdF21D137Aadc95588205586636710ca2890538d5"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: evmos_testnet
 - chain: evmos_testnet
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
   address: "0x74f09cb3c7e2A01865f424FD14F6dc9A14E3e94E"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zetachain_testnet
 - chain: zetachain_testnet
   address: "0x0708325268dF9F66270F1401206434524814508b"
   address: "0x0708325268dF9F66270F1401206434524814508b"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: neon_devnet
 - chain: neon_devnet
   address: "0x0708325268dF9F66270F1401206434524814508b"
   address: "0x0708325268dF9F66270F1401206434524814508b"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zksync_goerli
 - chain: zksync_goerli
   address: "0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1"
   address: "0x8739d5024B5143278E2b15Bd9e7C26f6CEc658F1"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: optimism_sepolia
 - chain: optimism_sepolia
   address: "0x0708325268dF9F66270F1401206434524814508b"
   address: "0x0708325268dF9F66270F1401206434524814508b"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: mode
 - chain: mode
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: mode_testnet
 - chain: mode_testnet
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: bttc_testnet
 - chain: bttc_testnet
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: bttc
 - chain: bttc
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zksync_sepolia
 - chain: zksync_sepolia
   address: "0x056f829183Ec806A78c26C98961678c24faB71af"
   address: "0x056f829183Ec806A78c26C98961678c24faB71af"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: base_sepolia
 - chain: base_sepolia
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: movement_evm_devnet
 - chain: movement_evm_devnet
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zkfair_testnet
 - chain: zkfair_testnet
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: blast_s2_testnet
 - chain: blast_s2_testnet
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: zkfair
 - chain: zkfair
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: filecoin_calibration
 - chain: filecoin_calibration
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
 - chain: filecoin
 - chain: filecoin
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
   address: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729"
-  type: EvmContract
+  type: EvmPriceFeedContract
+- chain: base_goerli
+  address: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF"
+  type: EvmEntropyContract

+ 4 - 4
contract_manager/store/contracts/SuiContracts.yaml

@@ -1,16 +1,16 @@
 - chain: sui_mainnet
 - chain: sui_mainnet
   stateId: "0xf9ff3ef935ef6cdfb659a203bf2754cebeb63346e29114a535ea6f41315e5a3f"
   stateId: "0xf9ff3ef935ef6cdfb659a203bf2754cebeb63346e29114a535ea6f41315e5a3f"
   wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
   wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
-  type: SuiContract
+  type: SuiPriceFeedContract
 - chain: sui_mainnet
 - chain: sui_mainnet
   stateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
   stateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
   wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
   wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
-  type: SuiContract
+  type: SuiPriceFeedContract
 - chain: sui_testnet
 - chain: sui_testnet
   stateId: "0xb3142a723792001caafc601b7c6fe38f09f3684e360b56d8d90fc574e71e75f3"
   stateId: "0xb3142a723792001caafc601b7c6fe38f09f3684e360b56d8d90fc574e71e75f3"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
-  type: SuiContract
+  type: SuiPriceFeedContract
 - chain: sui_testnet
 - chain: sui_testnet
   stateId: "0x2d82612a354f0b7e52809fc2845642911c7190404620cec8688f68808f8800d8"
   stateId: "0x2d82612a354f0b7e52809fc2845642911c7190404620cec8688f68808f8800d8"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
   wormholeStateId: "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02"
-  type: SuiContract
+  type: SuiPriceFeedContract

+ 2 - 0
package-lock.json

@@ -43,6 +43,7 @@
         "@injectivelabs/networks": "1.0.68",
         "@injectivelabs/networks": "1.0.68",
         "@mysten/sui.js": "^0.37.1",
         "@mysten/sui.js": "^0.37.1",
         "@pythnetwork/cosmwasm-deploy-tools": "*",
         "@pythnetwork/cosmwasm-deploy-tools": "*",
+        "@pythnetwork/entropy-sdk-solidity": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/pyth-sui-js": "*",
         "@pythnetwork/pyth-sui-js": "*",
         "aptos": "^1.5.0",
         "aptos": "^1.5.0",
@@ -79727,6 +79728,7 @@
         "@injectivelabs/networks": "1.0.68",
         "@injectivelabs/networks": "1.0.68",
         "@mysten/sui.js": "^0.37.1",
         "@mysten/sui.js": "^0.37.1",
         "@pythnetwork/cosmwasm-deploy-tools": "*",
         "@pythnetwork/cosmwasm-deploy-tools": "*",
+        "@pythnetwork/entropy-sdk-solidity": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/price-service-client": "*",
         "@pythnetwork/pyth-sui-js": "*",
         "@pythnetwork/pyth-sui-js": "*",
         "aptos": "^1.5.0",
         "aptos": "^1.5.0",

+ 2 - 2
target_chains/cosmwasm/deploy-scripts/src/instantiate-pyth.ts

@@ -4,7 +4,7 @@ import { sha256 } from "@cosmjs/crypto";
 import { getPythConfig } from "./configs";
 import { getPythConfig } from "./configs";
 import {
 import {
   CosmWasmChain,
   CosmWasmChain,
-  CosmWasmContract,
+  CosmWasmPriceFeedContract,
   DefaultStore,
   DefaultStore,
   Store,
   Store,
   toPrivateKey,
   toPrivateKey,
@@ -96,7 +96,7 @@ async function run() {
   });
   });
   console.log(`Contract admin set to ${address}`);
   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.contracts[contract.getId()] = contract;
   DefaultStore.saveAllContracts();
   DefaultStore.saveAllContracts();
   console.log("Added the following to your CosmWasm contracts configs");
   console.log("Added the following to your CosmWasm contracts configs");

+ 2 - 2
target_chains/cosmwasm/deploy-scripts/src/instantiate-wormhole.ts

@@ -3,7 +3,7 @@ import { hideBin } from "yargs/helpers";
 import { getWormholeConfig } from "./configs";
 import { getWormholeConfig } from "./configs";
 import {
 import {
   CosmWasmChain,
   CosmWasmChain,
-  CosmWasmContract,
+  CosmWasmPriceFeedContract,
   DefaultStore,
   DefaultStore,
   toPrivateKey,
   toPrivateKey,
   WormholeCosmWasmContract,
   WormholeCosmWasmContract,
@@ -47,7 +47,7 @@ async function run() {
     throw new Error(`Chain ${argv.chain} not found or not a CosmWasmChain`);
     throw new Error(`Chain ${argv.chain} not found or not a CosmWasmChain`);
   }
   }
   const privateKey = toPrivateKey(argv["private-key"]);
   const privateKey = toPrivateKey(argv["private-key"]);
-  const storeCodeRes = await CosmWasmContract.storeCode(
+  const storeCodeRes = await CosmWasmPriceFeedContract.storeCode(
     chain,
     chain,
     privateKey,
     privateKey,
     wasmFilePath
     wasmFilePath

+ 2 - 2
target_chains/ethereum/contracts/scripts/contractManagerConfig.js

@@ -1,5 +1,5 @@
 const {
 const {
-  EvmContract,
+  EvmPriceFeedContract,
   DefaultStore,
   DefaultStore,
   Store,
   Store,
   getDefaultDeploymentConfig,
   getDefaultDeploymentConfig,
@@ -47,7 +47,7 @@ function getDefaultConfig(_chainName) {
 }
 }
 function saveConfig(chainName, address) {
 function saveConfig(chainName, address) {
   const chain = DefaultStore.chains[chainName];
   const chain = DefaultStore.chains[chainName];
-  const contract = new EvmContract(chain, address);
+  const contract = new EvmPriceFeedContract(chain, address);
   DefaultStore.contracts[contract.getId()] = contract;
   DefaultStore.contracts[contract.getId()] = contract;
   DefaultStore.saveAllContracts();
   DefaultStore.saveAllContracts();
   console.log("Added the following to your evm contract configs");
   console.log("Added the following to your evm contract configs");

+ 4 - 4
target_chains/sui/cli/src/cli.ts

@@ -4,7 +4,7 @@ import {
   DefaultStore,
   DefaultStore,
   getDefaultDeploymentConfig,
   getDefaultDeploymentConfig,
   SuiChain,
   SuiChain,
-  SuiContract,
+  SuiPriceFeedContract,
 } from "contract_manager";
 } from "contract_manager";
 import { PriceServiceConnection } from "@pythnetwork/price-service-client";
 import { PriceServiceConnection } from "@pythnetwork/price-service-client";
 import { execSync } from "child_process";
 import { execSync } from "child_process";
@@ -49,8 +49,8 @@ const OPTIONS = {
   },
   },
 } as const;
 } 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) {
   if (!contract) {
     throw new Error(`Contract ${contractId} not found`);
     throw new Error(`Contract ${contractId} not found`);
   }
   }
@@ -58,7 +58,7 @@ function getContract(contractId: string): SuiContract {
 }
 }
 
 
 function getPriceService(
 function getPriceService(
-  contract: SuiContract,
+  contract: SuiPriceFeedContract,
   endpointOverride: string | undefined
   endpointOverride: string | undefined
 ): PriceServiceConnection {
 ): PriceServiceConnection {
   const defaultEndpoint = contract.getChain().isMainnet()
   const defaultEndpoint = contract.getChain().isMainnet()

+ 3 - 3
target_chains/sui/cli/src/upgrade_pyth.ts

@@ -6,7 +6,7 @@ import {
   TransactionBlock,
   TransactionBlock,
 } from "@mysten/sui.js";
 } from "@mysten/sui.js";
 import { execSync } from "child_process";
 import { execSync } from "child_process";
-import { SuiContract } from "contract_manager";
+import { SuiPriceFeedContract } from "contract_manager";
 
 
 export function buildForBytecodeAndDigest(packagePath: string) {
 export function buildForBytecodeAndDigest(packagePath: string) {
   const buildOutput: {
   const buildOutput: {
@@ -33,7 +33,7 @@ export async function upgradePyth(
   modules: number[][],
   modules: number[][],
   dependencies: string[],
   dependencies: string[],
   signedVaa: Buffer,
   signedVaa: Buffer,
-  contract: SuiContract
+  contract: SuiPriceFeedContract
 ) {
 ) {
   const pythPackage = await contract.getPackageId(contract.stateId);
   const pythPackage = await contract.getPackageId(contract.stateId);
 
 
@@ -78,7 +78,7 @@ export async function upgradePyth(
 export async function migratePyth(
 export async function migratePyth(
   signer: RawSigner,
   signer: RawSigner,
   signedUpgradeVaa: Buffer,
   signedUpgradeVaa: Buffer,
-  contract: SuiContract,
+  contract: SuiPriceFeedContract,
   pythPackageOld: string
   pythPackageOld: string
 ) {
 ) {
   const pythPackage = await contract.getPackageId(contract.stateId);
   const pythPackage = await contract.getPackageId(contract.stateId);