Skip to content

Commit 5fbca94

Browse files
committed
chore(target_chains/sui): add iota cli and sdk packages with no change
1 parent 13f4a88 commit 5fbca94

File tree

20 files changed

+2145
-217
lines changed

20 files changed

+2145
-217
lines changed

contract_manager/src/contracts/iota.ts

Lines changed: 568 additions & 0 deletions
Large diffs are not rendered by default.

pnpm-lock.yaml

Lines changed: 217 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ packages:
2121
- "target_chains/fuel/sdk/js"
2222
- "target_chains/starknet/sdk/js"
2323
- "target_chains/sui/sdk/js"
24+
- "target_chains/sui/sdk/js-iota"
2425
- "target_chains/sui/cli"
26+
- "target_chains/sui/cli-iota "
2527
- "target_chains/solana/sdk/js/solana_utils"
2628
- "target_chains/solana/sdk/js/pyth_solana_receiver"
2729
- "target_chains/ton/contracts"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Pre-requisites
2+
3+
Install move cli according to this [doc](../contracts/README.md)
4+
5+
# Deploying from scratch
6+
7+
Configure the `Move.toml` file accordingly. The wormhole address should be specified based on the target chain in the `Move.toml` and the pyth address should be `0x0`.
8+
We can deploy the pyth oracle and initialize it with the following command:
9+
10+
```bash
11+
npm run cli -- deploy --private-key <private-key> --chain [sui_mainnet|sui_testnet]
12+
```
13+
14+
You can then add your sui contract configs to the contract manager store.
15+
16+
You can also manually create all the price feeds available at the moment to make it easier for devs to test the oracle.
17+
18+
```bash
19+
npm run cli -- create-all --private-key <private-key> --contract <contract-id>
20+
```
21+
22+
# Updating price feeds:
23+
24+
You can use the `create` and `update-feeds` commands to create and update price feeds respectively.
25+
26+
```bash
27+
npm run cli -- create --feed-id <feed-id> --private-key <private-key> --contract <contract-id>
28+
```
29+
30+
```bash
31+
npm run cli -- update-feeds --feed-id <feed-id> --private-key <private-key> --contract <contract-id>
32+
```
33+
34+
# Upgrade process:
35+
36+
The following steps are needed to upgrade our sui contracts:
37+
38+
- Contract changes:
39+
- Create a new struct for the new version and update `current_version` and `previous_version` functions in `version_control` module
40+
- Implement any custom logic needed to migrate the data from the old struct to the new one in the `migrate` module
41+
- Update dependency (e.g. wormhole) addresses if needed
42+
- Generate the digest for the new contract build
43+
- Create a governance proposal, proposing the sui package to be upgraded to this specific digest
44+
- Approve and execute the governance proposal
45+
- Run the upgrade transaction and publish the new package
46+
47+
## Generating the new contract hash:
48+
49+
Run the following command to generate the new hash, make sure the contract addresses are identical to the deployed ones:
50+
51+
```bash
52+
npm run cli -- generate-digest
53+
```
54+
55+
## Upgrading the contract
56+
57+
To upgrade the contract after the governance vaa was executed run:
58+
59+
```bash
60+
npm run cli -- upgrade --private-key <private-key> --contract <contract-id> --vaa <upgrade-vaa>
61+
```
62+
63+
The upgrade procedure consists of 2 transactions. The first one is to upgrade the contract (sui level) and the second one is to run the `migrate` function and upgrade the version (package level).
64+
Since clients try to fetch the latest version of the package automatically, it's important to run the second transaction as soon as possible after the first one.
65+
66+
### FAQ:
67+
68+
- I'm seeing the error `Transaction has non recoverable errors from at least 1/3 of validators`. What should I do?
69+
Make sure you have enough funding in the wallet and try again. Usually a more descriptive error message is available in the returned value of the transaction.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "pyth-iota-cli",
3+
"version": "0.1.0",
4+
"description": "Pyth Sui Integration Cli tools",
5+
"main": "index.js",
6+
"license": "Apache-2.0",
7+
"scripts": {
8+
"cli": "ts-node src/cli.ts",
9+
"build": "tsc"
10+
},
11+
"private": "true",
12+
"dependencies": {
13+
"@certusone/wormhole-sdk": "^0.9.12",
14+
"@iota/iota-sdk": "^0.5.0",
15+
"@pythnetwork/contract-manager": "workspace:*",
16+
"@pythnetwork/price-service-client": "^1.4.0",
17+
"@pythnetwork/price-service-sdk": "^1.2.0",
18+
"@pythnetwork/xc-admin-common": "workspace:*",
19+
"prettier": "^2.8.7",
20+
"ts-node": "^10.9.1",
21+
"typescript": "^5.0.4",
22+
"yargs": "^17.7.2"
23+
},
24+
"devDependencies": {
25+
"@types/yargs": "^17.0.32"
26+
}
27+
}

0 commit comments

Comments
 (0)