MCPcopy Create free account
hub / github.com/cardstack/cardstack / getOracleByNetwork

Function getOracleByNetwork

packages/cardpay-sdk/contracts/addresses.ts:83–96  ·  view source on GitHub ↗
(tokenName: string, network: string)

Source from the content-addressed store, hash-verified

81}
82
83export function getOracleByNetwork(tokenName: string, network: string): string {
84 let oracles = addresses[network].oracles;
85 if (!oracles) {
86 throw new Error(`No oracles have been defined for the network ${network}`);
87 }
88 if (typeof oracles === 'string') {
89 throw new Error(`the addresses entry "oracles" must be a group of oracles for network ${network}`);
90 }
91 let address = oracles[tokenName];
92 if (!address) {
93 throw new Error(`No oracle exists for the token '${tokenName}' for the network ${network}`);
94 }
95 return address;
96}
97
98export async function getOracle(tokenName: string, web3: Web3): Promise<string> {
99 let network = await networkName(web3);

Callers 1

getOracleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected