[evm] [cosmwasm] Minor cleanup (#1027)
* Remove old cosmwasm address documentation * Remove old evm migration folder and keep prod-receiver
This commit is contained in:
parent
b9dbd54d5a
commit
78ca49dcc3
|
@ -240,22 +240,6 @@ export class WormholeEvmContract extends WormholeContract {
|
|||
return currentSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this contract is a deployment of wormhole-receiver or wormhole.
|
||||
* The wormhole-receiver is a subset of the wormhole contract optimized for just verifying the VAAs.
|
||||
* The check is done by calling a function that only exists in the wormhole contract and not in the wormhole-receiver.
|
||||
* If the function call fails, we know that this is a wormhole-receiver contract.
|
||||
*/
|
||||
async isWormholeReceiver(): Promise<boolean> {
|
||||
const wormholeContract = this.getContract();
|
||||
try {
|
||||
await wormholeContract.methods.messageFee().call();
|
||||
return false;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async upgradeGuardianSets(senderPrivateKey: PrivateKey, vaa: Buffer) {
|
||||
const web3 = new Web3(this.chain.getRpcUrl());
|
||||
const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
|
||||
|
|
|
@ -20,24 +20,6 @@ A typical query requires to pass the price feed id as a hex string. it will look
|
|||
}
|
||||
```
|
||||
|
||||
## Contracts and Price Feeds
|
||||
|
||||
Pyth is currently available on the following cosmwasm chains:
|
||||
|
||||
### Testnet
|
||||
|
||||
| Network | Contract address |
|
||||
| --------- | -------------------------------------------- |
|
||||
| Injective | `inj1z60tg0tekdzcasenhuuwq3htjcd5slmgf7gpez` |
|
||||
|
||||
Available price feeds on these networks can be find below:
|
||||
|
||||
### Price Feeds
|
||||
|
||||
| Network | Available Price Feeds |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Injective Testnet | [https://pyth.network/developers/price-feed-ids#injective-testnet](https://pyth.network/developers/price-feed-ids#injective-testnet) |
|
||||
|
||||
## Developing
|
||||
|
||||
The cosmwasm contract lives in the `pyth` subdirectory.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Migrations Metadata
|
||||
MIGRATIONS_DIR=./migrations/prod
|
||||
MIGRATIONS_DIR=./migrations/prod-receiver
|
||||
MIGRATIONS_NETWORK=development
|
||||
WORMHOLE_CHAIN_NAME=ethereum
|
||||
CLUSTER=testnet
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Network Config
|
||||
MIGRATIONS_DIR= # ./migrations/prod
|
||||
MIGRATIONS_DIR= # ./migrations/prod-receiver
|
||||
MIGRATIONS_NETWORK= # xyz
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ This is the deployment process:
|
|||
|
||||
1. Follow the installation instructions in the [README.md](./README.md).
|
||||
2. As a sanity check on deploying changes for the first time, it is recommended to deploy the migrations
|
||||
in `migrations/prod` to the Truffle `development` network first. You can do this by using the configuration
|
||||
in `migrations/prod-receiver` to the Truffle `development` network first. You can do this by using the configuration
|
||||
values in [`.env.prod.development`](.env.prod.development).
|
||||
3. If you have changed the contract make sure that:
|
||||
- The change is not breaking the storage.
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
const Migrations = artifacts.require("Migrations");
|
||||
|
||||
const tdr = require("truffle-deploy-registry");
|
||||
|
||||
module.exports = async function (deployer, network) {
|
||||
await deployer.deploy(Migrations);
|
||||
let migrationsInstance = await Migrations.deployed();
|
||||
|
||||
if (!tdr.isDryRunNetworkName(network)) {
|
||||
await tdr.appendInstance(migrationsInstance);
|
||||
}
|
||||
};
|
|
@ -1,73 +0,0 @@
|
|||
const loadEnv = require("../../scripts/loadEnv");
|
||||
loadEnv("../../");
|
||||
|
||||
const PythUpgradable = artifacts.require("PythUpgradable");
|
||||
const { deployProxy } = require("@openzeppelin/truffle-upgrades");
|
||||
const tdr = require("truffle-deploy-registry");
|
||||
const { CONTRACTS } = require("@certusone/wormhole-sdk");
|
||||
const { assert } = require("chai");
|
||||
const {
|
||||
saveConfig,
|
||||
getDefaultConfig,
|
||||
} = require("../../scripts/contractManagerConfig");
|
||||
|
||||
const {
|
||||
governanceEmitter,
|
||||
governanceChainId,
|
||||
emitterAddresses,
|
||||
emitterChainIds,
|
||||
} = getDefaultConfig(process.env.MIGRATIONS_NETWORK);
|
||||
// Default value for this field is 0
|
||||
const governanceInitialSequence = Number(
|
||||
process.env.GOVERNANCE_INITIAL_SEQUENCE ?? "0"
|
||||
);
|
||||
|
||||
const validTimePeriodSeconds = Number(process.env.VALID_TIME_PERIOD_SECONDS);
|
||||
const singleUpdateFeeInWei = Number(process.env.SINGLE_UPDATE_FEE_IN_WEI);
|
||||
|
||||
console.log("emitterChainIds: " + emitterChainIds);
|
||||
console.log("emitterAddresses: " + emitterAddresses);
|
||||
console.log("governanceEmitter: " + governanceEmitter);
|
||||
console.log("governanceChainId: " + governanceChainId);
|
||||
console.log("governanceInitialSequence: " + governanceInitialSequence);
|
||||
console.log("validTimePeriodSeconds: " + validTimePeriodSeconds);
|
||||
console.log("singleUpdateFeeInWei: " + singleUpdateFeeInWei);
|
||||
|
||||
module.exports = async function (deployer, network) {
|
||||
const cluster = process.env.CLUSTER;
|
||||
const chainName = process.env.WORMHOLE_CHAIN_NAME;
|
||||
|
||||
assert(cluster !== undefined && chainName !== undefined);
|
||||
|
||||
const wormholeBridgeAddress =
|
||||
CONTRACTS[cluster.toUpperCase()][chainName].core;
|
||||
assert(wormholeBridgeAddress !== undefined);
|
||||
|
||||
console.log("Wormhole bridge address: " + wormholeBridgeAddress);
|
||||
|
||||
// Deploy the proxy. This will return an instance of PythUpgradable,
|
||||
// with the address field corresponding to the fronting ERC1967Proxy.
|
||||
let proxyInstance = await deployProxy(
|
||||
PythUpgradable,
|
||||
[
|
||||
wormholeBridgeAddress,
|
||||
emitterChainIds,
|
||||
emitterAddresses,
|
||||
governanceChainId,
|
||||
governanceEmitter,
|
||||
governanceInitialSequence,
|
||||
validTimePeriodSeconds,
|
||||
singleUpdateFeeInWei,
|
||||
],
|
||||
{ deployer }
|
||||
);
|
||||
|
||||
// Add the ERC1967Proxy address to the PythUpgradable contract's
|
||||
// entry in the registry. This allows us to call upgradeProxy
|
||||
// functions with the value of PythUpgradable.deployed().address:
|
||||
// e.g. upgradeProxy(PythUpgradable.deployed().address, NewImplementation)
|
||||
if (!tdr.isDryRunNetworkName(network)) {
|
||||
await tdr.appendInstance(proxyInstance);
|
||||
}
|
||||
saveConfig(process.env.MIGRATIONS_NETWORK, proxyInstance.address);
|
||||
};
|
Loading…
Reference in New Issue