Skip to content

Commit c4c4a63

Browse files
jayantk666lcz
andauthored
[price_pusher] Create gas pool for Sui (#923)
* [sui][price_pusher]Implement gas pool * Add the option to specify gas budget to avoid dry run * Avoid for loop in constructing transaction block * Improve error handling * Implement coin consolidation * minor tweaks * k * cleanup * fix --------- Co-authored-by: Chris Li <chris@mystenlabs.com>
1 parent 382a6fc commit c4c4a63

File tree

4 files changed

+295
-59
lines changed

4 files changed

+295
-59
lines changed

price_pusher/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,19 @@ npm run start -- aptos --endpoint https://fullnode.testnet.aptoslabs.com/v1 \
9191
[--polling-frequency 5] \
9292

9393
# For Sui
94-
npm run start -- sui
95-
--endpoint https://sui-testnet-rpc.allthatnode.com,
96-
--pyth-package-id 0x975e063f398f720af4f33ec06a927f14ea76ca24f7f8dd544aa62ab9d5d15f44,
97-
--pyth-state-id 0xd8afde3a48b4ff7212bd6829a150f43f59043221200d63504d981f62bff2e27a,
98-
--wormhole-package-id 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e,
99-
--wormhole-state-id 0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02,
100-
--price-feed-to-price-info-object-table-id 0xf8929174008c662266a1adde78e1e8e33016eb7ad37d379481e860b911e40ed5,
101-
--price-service-endpoint https://xc-testnet.pyth.network,
102-
--mnemonic-file ./mnemonic,
103-
--price-config-file ./price-config.testnet.sample.yaml
94+
npm run start -- sui \
95+
--endpoint https://sui-testnet-rpc.allthatnode.com \
96+
--pyth-package-id 0x975e063f398f720af4f33ec06a927f14ea76ca24f7f8dd544aa62ab9d5d15f44 \
97+
--pyth-state-id 0xd8afde3a48b4ff7212bd6829a150f43f59043221200d63504d981f62bff2e27a \
98+
--wormhole-package-id 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e \
99+
--wormhole-state-id 0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02 \
100+
--price-feed-to-price-info-object-table-id 0xf8929174008c662266a1adde78e1e8e33016eb7ad37d379481e860b911e40ed5 \
101+
--price-service-endpoint https://xc-testnet.pyth.network \
102+
--mnemonic-file ./mnemonic \
103+
--price-config-file ./price-config.testnet.sample.yaml \
104104
[--pushing-frequency 10] \
105105
[--polling-frequency 5] \
106+
[--num-gas-objects 30]
106107

107108

108109
# Or, run the price pusher docker image instead of building from the source

price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "5.4.1",
3+
"version": "5.4.2",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

price_pusher/src/sui/command.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,25 @@ export default {
6666
required: true,
6767
default: 1,
6868
} as Options,
69+
"num-gas-objects": {
70+
description: "Number of gas objects in the pool.",
71+
type: "number",
72+
required: true,
73+
default: 30,
74+
} as Options,
75+
"gas-budget": {
76+
description: "Gas budget for each price update",
77+
type: "number",
78+
required: true,
79+
default: 500_000_000,
80+
} as Options,
6981
...options.priceConfigFile,
7082
...options.priceServiceEndpoint,
7183
...options.mnemonicFile,
7284
...options.pollingFrequency,
7385
...options.pushingFrequency,
7486
},
75-
handler: function (argv: any) {
87+
handler: async function (argv: any) {
7688
const {
7789
endpoint,
7890
priceConfigFile,
@@ -86,6 +98,8 @@ export default {
8698
wormholeStateId,
8799
priceFeedToPriceInfoObjectTableId,
88100
maxVaasPerPtb,
101+
numGasObjects,
102+
gasBudget,
89103
} = argv;
90104

91105
const priceConfigs = readPriceConfigFile(priceConfigFile);
@@ -128,7 +142,7 @@ export default {
128142
priceItems,
129143
{ pollingFrequency }
130144
);
131-
const suiPusher = new SuiPricePusher(
145+
const suiPusher = await SuiPricePusher.createWithAutomaticGasPool(
132146
priceServiceConnection,
133147
pythPackageId,
134148
pythStateId,
@@ -137,7 +151,9 @@ export default {
137151
priceFeedToPriceInfoObjectTableId,
138152
maxVaasPerPtb,
139153
endpoint,
140-
mnemonic
154+
mnemonic,
155+
gasBudget,
156+
numGasObjects
141157
);
142158

143159
const controller = new Controller(

0 commit comments

Comments
 (0)