|
|
6 maanden geleden | |
|---|---|---|
| .. | ||
| src | d87c246a73 fix: aptos imports | 5 maanden geleden |
| .gitignore | 80a7c05cda fix: add aptos cli and add movement testnet aptos network (#1777) | 1 jaar geleden |
| README.md | 1b5195aa0a fix: run turbo fix | 8 maanden geleden |
| package-lock.json | 084acdb57e [refactor] Convert hyphen to underscore in the directory tree (#524) | 2 jaren geleden |
| package.json | b1dc4c27f5 chore: move prettier to individual packages & upgrade prettier | 8 maanden geleden |
| tsconfig.json | a899d658da refactor: split structure into core/node | 5 maanden geleden |
Install aptos cli with the same version specified in the ci workflows.
All the commands which submit transactions require an environment variable APTOS_PRIVATE_KEY for the private key to be set.
In addition to the wormhole dependency we depend on the deployer contract that facilitates the ownership of package upgrade capability. You can read more about it here.
Assuming the wormhole and deployer contracts are already deployed, we can deploy the pyth oracle with the following command:
npm run cli deploy-pyth -- ../contracts <seed> \
-n aptos_testnet \
--deployer <deployer-address> \
--wormhole <wormhole-address>
seed can be any random string that is used for determining a specific contract address based on the seed value and the signer address.
You can manually specify the address of wormhole and deployer contracts with --wormhole and --deployer flags.
This requires the addresses to be empty in the Move.toml file for the pyth package:
[addresses]
pyth = "_"
deployer = "_"
wormhole = "_"
You can run the following to initialize the pyth contract:
npm run cli init-pyth -- <seed> -n <network> \
--stale-price-threshold 60 \
--update-fee 1 \
--channel <stable-or-beta>
The following steps are needed to upgrade our aptos contracts:
Run the following command to generate the new hash, this will assume the default deployed addresses of deployer, wormhole, and pyth, but you can override them if necessary.
npm run cli hash-contracts -- ../contracts
Here are sample steps you can take to create a proposal via the contract manager shell (npm run shell in contract manager package):
let wallet = await loadHotWallet("/path/to/solana/wallet.json");
let vault =
DefaultStore.vaults.devnet_6baWtW1zTUVMSJHJQVxDUXWzqrQeYBr6mu31j3bTKwY3;
await vault.connect(wallet);
let payload =
DefaultStore.chains.aptos_testnet.generateGovernanceUpgradePayload(
"CONTRACT_HASH_TO_USE",
);
await vault.proposeWormholeMessage([payload]);
After the approval process, you can fetch the VAA for the transaction and execute it by running:
import { SubmittedWormholeMessage } from "./src/governance";
let msg = await SubmittedWormholeMessage.fromTransactionSignature(
"tx_signature",
"devnet or mainnet-beta",
);
let vaa = await msg.fetchVaa();
let contract =
DefaultStore.contracts
.aptos_testnet_0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387;
await contract.executeGovernanceInstruction(
"private-key-of-account-inaptos",
vaa,
);
To upgrade the contract after the governance vaa was executed run:
npm run cli upgrade -- ../contracts