-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chore:pricefeed) deploy cronos zkevm (#1790)
* wip-temp * d * deployed cronos-zkevm
- Loading branch information
Showing
10 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
target_chains/ethereum/contracts/scripts/contractManagerConfig.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const { | ||
EvmContract, | ||
DefaultStore, | ||
Store, | ||
getDefaultDeploymentConfig, | ||
} = require("@pythnetwork/contract-manager"); | ||
|
||
function convertAddress(address) { | ||
return "0x" + address; | ||
} | ||
|
||
function convertChainId(number) { | ||
return "0x" + number.toString(16); | ||
} | ||
|
||
function getDefaultConfig(chainName) { | ||
const chain = DefaultStore.chains[chainName]; | ||
console.log("***chain", chain); | ||
const { dataSources, governanceDataSource, wormholeConfig } = | ||
getDefaultDeploymentConfig("stable"); | ||
|
||
const emitterChainIds = dataSources.map((dataSource) => | ||
convertChainId(dataSource.emitterChain) | ||
); | ||
const emitterAddresses = dataSources.map((dataSource) => | ||
convertAddress(dataSource.emitterAddress) | ||
); | ||
const governanceChainId = convertChainId(governanceDataSource.emitterChain); | ||
const governanceEmitter = convertAddress(governanceDataSource.emitterAddress); | ||
|
||
const wormholeInitialSigners = | ||
wormholeConfig.initialGuardianSet.map(convertAddress); | ||
const wormholeGovernanceChainId = convertChainId( | ||
wormholeConfig.governanceChainId | ||
); | ||
const wormholeGovernanceContract = convertAddress( | ||
wormholeConfig.governanceContract | ||
); | ||
|
||
return { | ||
governanceEmitter, | ||
governanceChainId, | ||
emitterAddresses, | ||
emitterChainIds, | ||
wormholeInitialSigners, | ||
wormholeGovernanceChainId, | ||
wormholeGovernanceContract, | ||
}; | ||
} | ||
function saveConfig(chainName, address) { | ||
const chain = DefaultStore.chains[chainName]; | ||
const contract = new EvmContract(chain, address); | ||
DefaultStore.contracts[contract.getId()] = contract; | ||
DefaultStore.saveAllContracts(); | ||
console.log("Added the following to your evm contract configs"); | ||
console.log(Store.serialize(contract)); | ||
} | ||
|
||
module.exports = { saveConfig, getDefaultConfig }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters