Skip to content

Commit

Permalink
chore: add new deployment files
Browse files Browse the repository at this point in the history
This change adds the new deployment files that upgrade wormhole and pyth
contract. It also updates the README to reflect the removal of
pyth-helper and replaces them with pyth-oracle.
  • Loading branch information
ali-bahjati committed Jan 22, 2024
1 parent 2845950 commit af24fd8
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 18 deletions.
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,29 @@ $ npm test

### Latest Deployments

| network | address |
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| testnet | [ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-helper-v1](https://explorer.hiro.so/txid/0x5339f90ccdbb88e437b9b889613f1554c377d5815e3b90bbc6305b317b7bb8e8?chain=testnet) |
| mainnet | [SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-helper-v1](https://explorer.hiro.so/txid/0xd86c2fda8a090c43016250c33231878673af62ac95d9c50645f6e2c303b9a173?chain=mainnet) |
| network | address |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| testnet | [ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-oracle-v2](https://explorer.hiro.so/txid/0x59dc127b983fcb8027706191b62138eb73a3ade8ecdbad5e99df4d2bfbbd6dfb?chain = testnet) |
| mainnet | [SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-oracle-v2](https://explorer.hiro.so/txid/0xee803f98e61c1d46d36d130c29d4a78099c8fb5700528226f3dc5a104954ffeb?chain = mainnet) |

### Onchain

The `pyth-helper-v1` contract is exposing the following method:
The `pyth-oracle-v2` contract is exposing the following method:

```clarity
(define-public (read-price
(price-feed-id (buff 32))))
(define-public (read-price-feed
(price-feed-id (buff 32))
(pyth-storage-address <pyth-storage-trait>)))
```

That can be consumed with the following invocation:

```clarity
(contract-call?
'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-oracle-v2 ;; Address of the helper contract
read-price
0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43) ;; BTC-USD price identifier
{
pyth-storage-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-storage-v1,
pyth-decoder-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-pnau-decoder-v1,
wormhole-core-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.wormhole-core-v2
}
read-price-feed
0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43 ;; BTC-USD price identifier
'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-store-v1)
```

The authenticity of the price feeds is verified during their ingestion, making the cost of queries as light as possible.
Expand Down Expand Up @@ -128,7 +125,7 @@ This VAA can be encoded as a Clarity buffer, and submitted to the Pyth contract
verify-and-update-price
0x504e41550100000003b8...a7b10321ad7c2404a910 ;; BTC-USD price update
{
pyth-storage-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-storage-v1,
pyth-storage-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-store-v1,
pyth-decoder-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-pnau-decoder-v1,
wormhole-core-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.wormhole-core-v2
})
Expand Down
2 changes: 1 addition & 1 deletion contracts/pyth-oracle-v2.clar
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;; Title: pyth-oracle
;; Version: v1
;; Version: v2
;; Check for latest version: https://github.com/hirosystems/stacks-pyth-bridge#latest-version
;; Report an issue: https://github.com/hirosystems/stacks-pyth-bridge/issues

Expand Down
4 changes: 2 additions & 2 deletions contracts/wormhole/wormhole-core-v2.clar
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;; Title: wormhole-core
;; Version: v1
;; Version: v2
;; Check for latest version: https://github.com/hirosystems/stacks-pyth-bridge#latest-version
;; Report an issue: https://github.com/hirosystems/stacks-pyth-bridge/issues

Expand Down Expand Up @@ -379,4 +379,4 @@
{
cursor: (+ u1 (get cursor acc)),
result: (get result acc),
}))
}))
File renamed without changes.
File renamed without changes.
114 changes: 114 additions & 0 deletions deployments/v1/1-upgrade-wormhole-core-v2.mainnet-plan.yaml

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions deployments/v1/1-upgrade-wormhole-core-v2.testnet-plan.yaml

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions deployments/v1/2-upgrade-pyth-oracle-v2.mainnet-plan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: 0
name: Mainnet deployment
network: mainnet
stacks-node: "https://api.hiro.so"
bitcoin-node: "http://blockstack:[email protected]:8332"
plan:
batches:
- id: 0
transactions:
- contract-publish:
contract-name: pyth-oracle-v2
expected-sender: SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0
cost: 1500000
path: contracts/pyth-oracle-v2.clar
anchor-block-only: true
clarity-version: 2
- contract-call:
contract-id: SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-governance-v1
expected-sender: SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0
method: update-pyth-oracle-contract
parameters:
- 0x01000000030d044ce04515ca1bb86efcca35689dfe05f807a1777d0fd00f41fd4a6d6632565151338b06fc0ddd7ca818d0185ae498b40c14b417927c5efdbdcdc4f3576022d0280105dc270846d3dbd70c75e9b27f1e311b6d28711d603ef8c023d0d703437eecfc355884c32dc0d890a9613c375eaf08c8f2396367a980152720d480c761ebb4f27f01079c83a462ac207417c3db4fed70cac673e76054bbcf9ac49281230c52df1051a64db1208012097c5d320c6c55223593eecd84923fc998c0952b761be07597a56d00088ad9f72005fce5f71e01da3c07223a693496aee31a78b1de3b596bf6d7db9f313eeeca6bcf22476fe768589f1eb33b9edaf82079e35cba894b700bcfc2f770d40009efad48bd8ca2c21a385ce0bba12b76b3d0531694f6018c71cf693b3cbd63f875094060cf252ad4d44133f96f526b48c0b6a81725e51dcd6b62b7c2562cae4674010b01695bec37c4e1a20e84c8dbcd2e6c57106e8fa57c94d3111c0fae47fc1b819b3b59431a26d1d76dd3fd9c945d4c211322d7f4fd464bf63500426943913af6da000c241bb8c124fea2f506260b6e5eb3d71f3d25b2b514e7464a344905a6f8e1827a237701a704189e7a315e6838e489ad7c55a52b5db52cd005345612abe292f307000dc8715d4d6fea307b6ea82c081f6b3bce76733409147080dcb050a61073c13ee92f74f76a30b1bb9556984e3a82635e480017b03d2a928ef94215962aacc28da6000edc04978ed74cafe6aeab5434f3bb801aadcac7af635d3dc6b31fa3d71c199c7d47904325c37270183775401e4008ce7a038f4cf5d67a5e9822213d83663969e0010f75f6a6d0de3151a5754c62f0f77d2c417301136302f55f0ab62c7a1f3df061645ac050dc1a99ab49835e88ed9521004f8e433f8365952b762d15c4427eff07260010a49259faeda20f00270b4efee2df041d4d47fa01e3e2b9745e3e69ba1c1cbb987802d417977a54db56d2bce8935d4636a3d393e166e3706810286a4dc4fcd48f001180f5002ba14e25e3376ff57e9c9d2ddde1ce333378a56e9f88cd9ccafd9ed1984a058e923603ab20cd4d7e4eff8500b39e5b42119d87f69fd62edc5e56e861c100122ddbe4722e964d21ce55f8a7c83652683a5606d5b0e8323fd8600f1311f6e6585eaafd774befd804e96f846bb35cb6d236686c1bf5829fcd03e953492621d0920165a505af0000000000015635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e000000000000007d015054474d0300ea86250616b4594f9cb0dfef749ec4d1099570179958394ef00e707974682d6f7261636c652d7632
- "'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.wormhole-core-v2"
cost: 1000000
- id: 1
transactions:
- contract-call:
contract-id: SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-oracle-v2
expected-sender: SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0
method: verify-and-update-price-feeds
parameters:
# PNAU payload
- 0x504e41550100000003b801000000030d026b102bc02cdb8bdb4894627bf84a2e0fdb60262e086adaef120602351c27a68709e7d353b094f52b8d811845a717accc2635d71ccd67ba41c37d5dad886deb7800030bbe7dda773f536db496a3573afceb9cd952ddce136edce96bc2bc52cfcfde494819a6765545afaea3ca62a0098ee18c45bf2b71afad5e26bbb3d358cac66299000443bfed7d6d49ffe8980d955e1704c37dd9cea9b5c477c81cc0713ed2c0f30e913054ccb53fd81d492e5226bf8b2f593debe5b6a43b9991b176949b5db204ccde00061509d1b53e47f1542397f79b14ffef49843279957e524e55cc3d7597c326713e742ba3ad33fc9ff484e0421d19cde9f4be90042116b3ea8962c592f8bbda23e40107c29f886d3fe660f214c32d00769c49156fe7f1683c881b675f81c0a00b50d3f37421b2193c7f2aa95ee6ca02ddc6c79877f6685e5696ed49542a71340ef8beca01085743d5682e17c149ffa13f03220204d4a797a9064708f7c9ce3fc5e5daad9a5e3620def0b69893a80d7079e34358b50db06ce1f7310fadd9c911b534756a2dcb010aae2132e31461e2b904e95abb5e01e12787e71d3bbc29b41dd235c398d0de87d27403d3be6f465d204ef471f8739424c030512581da692e8d379483f5ecdcb22c010b1e9eb4223a0efdcb730ca0955a9301ec65c259154751f4058facdbadc703effa0cb6f3be39ab9c8abf79a98a7168194795dcd835e495afc8bf71e349c8c16e00010d155e34124941d4544a0ad78b0872a3c9d69f81ae61d03d71063a460f7ab0578a6905bef01362dd4cc8a9e7130a8c8ec120f9b13b993c7535f6a1f0df25ac36e3010e484b48e38e5f3936530b5e157348923a416746a88ca89d6c67da8c35033adf584242c53a9a2ac1b1f2516d681ce8ee5a36f7ba11f457b4521d70ddc1736b8108010f63d7ff14ce7936dc498893c00573243dc0481934ddcb4c2e71c527e63b5cb58067a878e14ace924a5f2e80d6b8637609d9e1cb4e9950e660af34a425b3899ca00110ab6c35bee875593535ebdb9330fccf385729699c663dbb4c652505e29702c666163800fc87665a245c3737bbaa1d8c75ec4ce617e82dc661217276ec8195374b0012921b631d1ad6c6604c1f86738e787ae50a0f7203b4e0c4df62e39561be3a309d109eaf9be3d3398d0220376055e40493a02424143613ceb8934171769aa63afc0165aeb9e300000000001ae101faedac5851e32b9b23b5f9411a8c2bac4aae3ed4dd7b811dd1a72ea4aa7100000000023a7c8e0141555756000000000007421d35000027101fc023e3636689c705ebae2b5992cdbe4af3a6ac01005500ec7a775f46379b5e943c3526b1c8d54cd49749176b0b98e02dde68d1bd335c170000000008630cf8000000000002265bfffffff80000000065aeb9e30000000065aeb9e3000000000852ef0c00000000000254480a499e6012f4e65e5262a240f06cdc2e936528c025b6921cd1d796cd706ef7004b4c84f78098ce07a926b5b5111e6f0a1747fe50b745323f42eeb25850e3e4539eec7c035a3f7c89b03e3f851c8968f89ff4d4239f529681886e798605d6930ea09049bed5d1704bde473fdea271e4577e40fb3c10b1fd7e0f10accbb18506914c3a46a21e3267a247bf5ed734de7dd360677ffa4432265df877a72eee404e486d4bf88c54b9f869dec66a3c7cc3b367e4460fd86a2f4d843c73c5219279901a76c0786e172f832f60
- "{
pyth-storage-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-store-v1,
pyth-decoder-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.pyth-pnau-decoder-v1,
wormhole-core-contract: 'SP2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY2P2PKN0.wormhole-core-v2
}"
cost: 1000000
40 changes: 40 additions & 0 deletions deployments/v1/2-upgrade-pyth-oracle-v2.testnet-plan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: 0
name: Testnet deployment
network: testnet
stacks-node: "https://api.testnet.hiro.so"
bitcoin-node: "http://blockstack:[email protected]:8332"
plan:
batches:
- id: 0
transactions:
- contract-publish:
contract-name: pyth-oracle-v2
expected-sender: ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E
cost: 1500000
path: contracts/pyth-oracle-v2.clar
anchor-block-only: true
clarity-version: 2
- contract-call:
contract-id: ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-governance-v1
expected-sender: ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E
method: update-pyth-oracle-contract
parameters:
- 0x01000000030d013c560c6bbc713803096ee90e0994ad503b392fea10c5b8490d8771a8faac0d494eee6db9548718a6bd58e2fbfd0a81a93611a8d2ad237a914c95b43870e95fde01045afb91eb8b6513a33fbfc671ba6a798a5c72c05ecbeaa9341d4b0e3ecb6b9797484f0211706c025b0fded280e43723a9552c6e0a458ff087e0aa033504e7077d0005f80bc8122ca76a6a00b836be9b7c62501aa53296500bf22640a83e53a225e45b52c24a5fcad47ffd6aeb95ec45ac14332163f1c4cfe0a0e600183d78618a649c0007ce8f665edb3f32eae5f9072d8b6ddf004e74e06f2f5c41f457d2b126a0f5d1d25ea7486222c4a85d8ad7e84555efc8b9d46df369b4b504d466e05b73c71623b10108401a43a3ed21ef8c05d4719c586c56f4ec4710242abfc211919738a03f3990fc3d1f9af94104f4593bf93a8a4bb8f74b1ce3056c8f919de3fc6c18f36e0e1da100094ea84cbbee2683cceae8169e791d5f0b6e1d8a98ba9015847ae2314238d88c757112f355d67d796d7de050959eabb4934d8ffebdb2a5ee97bc965a6fa3779a4b000b4a569948a156a2624df5ca7c1daf8b01b24d98e9cc813c595e330f0b4923619524eff06ea78edb5705ca3540d48ed6a1f2dfc0ffd33b69d02e641e751caea737000cf53f8dc11fdcfafcf88ada961876385e475d9d1cca85f6b03624a54807cf28c25f8ee9655ee202a51a794de397610253fa8710b70ce3086bf18b2942c7b6c19b010d9203e26195c7c4aae2fcb9449665885e9cad8acee081a217e2163eee6b75cb40180583dbe871b012625b1e5920bc3153a1a7c5fdebfc99c47a68d461ab4c0221000ff563b950953e5bd6f48f6657ca4e0561a71e07316b240393fd04f0fac0396c0955e488b56ffffb237bfdbfa79d56b16c8262ec7e7c306d4b8019ddd8662e1614011087f0c8e6f42139cb9b58c4c7e4ddb894776dc306745d6028532b4e963c2b1e4a0c3fdea84b5fd4f8ffa8dd0aa1ceaf08607c2c687df827829ca6386fe375548701117a7ab02704af53a5d0e92c7f50330398167ae8bd4c907c3fe6a587f848ca481740c41aed5dbe7899d6d9784331577f77dfa36a042987e4dcab3b93af27bdc3a30012fbc3be66ae6aecb7a1e81e8537cec709fe19089aeb6df32aa302ae441f216d814659a6e25942a50e760697cd0aa97764e6ac355a2e9c88a74529aeeecdb57b8f0165a505a90000000000015635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e000000000000007c015054474d0300c37725061ab4594f9cb0dfef749ec4d1099570179958394ef00e707974682d6f7261636c652d7632
- "'ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.wormhole-core-v2"
cost: 1000000
- id: 1
transactions:
- contract-call:
contract-id: ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-oracle-v2
expected-sender: ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E
method: verify-and-update-price-feeds
parameters:
# PNAU payload
- 0x504e41550100000003b801000000030d0221e8cc3d46a31cfec2d9c923fbf9769244fbfda0541ceee60a9be20381870a10772422dfba0553a1153fddcd68787781e6cdfcc2a8a423e7115ec0f82489c9f7010389a20662a1641c7d028a48bd8bc3fd4e3bab55bd05595dc3c2ee3a9636e000f47738b6b94f024ed2e9db712ee53e3a769c4ece5370c0c75b6d067efc0a0738df000402a383ede342042ede33259b998f7082d7bbd0d4a1cfc307dbd0c8a770b430f96ffc7612245939db4a58229150c16d00111ab674d173ae545df595f7f346a50e010672c91c2f91e8c580059aabc0c67e688dd33510a1ffa4f967e035906d71924ac82dde2e66587a26076079ac4b2e51306e9d76c376679343e905465aac5d087c9e0107c0014d1631d99224415fb9b28d89031632adb20074a3b8c1b8ffae7566f9b1cc04e95d79b296808b282b40ccf7793ecb0bf29b4bf32595d1f1fd984495ca22180008b4dcb85fd705e131c27b52020a02b75182f050035ee1aa38529816a82aa6a01f2f29b9c7c3c86c7aa9459dd8e5680db584e408b509cebb36da11f4f89ed45dd2000b31c0d3a3275bb9270706c397260a7d984aa935a296f1eb8b20cdcbf6d57b726370637c958cc88136e1cb59578b67d8bb253b3ec6ee9e55e306b06e2939d49016000cc3d981ce7b9aa2a7d1d4c545d14e7c0b5494cd907e73365a8bd9f9b795eb254d50e861d60a0dece7e0a454c44b92c28d88e3d9f043f7afba23cbc27b39dd2723010dfb185cfb06cfc91395543341ca600ecc54d033745b16f16d485512d24de7326005a9e01674b820d9ed37f49b5a064d475fe90c1646a94b0a75b46d888c9e9ff1010ef225d346610362267cc95030bab12f7ded66e90931cd7b33a75b2e3ac100758445bfc7e956777051f23cb52a1c3ea31825e05f404ae1e2ef19497bd35a14a094000f89a42f6a6bc80d2630fc7f088bef763c63dd0ecd432009b31db509e91ddaa76603d889112b49b9c996f23110e1a21e9f8bf160de62027f27cfa4a4b664e523de00105fbc3e45bfe249c1d55ee34b2c19ccfd1c6f61b801fbb87a027ef560d16a29f456d27d0a8555a614d57f4c3c421a9380ba9c7ef11aa094730a701fcc9c9176a30112c81637eba3e28234c3e520c14afa0e84288296ed330043fce9384a1e66aa27703b89351bd90b0c880fb0dae89cb49d98abe9b0862c7b83e426e2a54a22f26ece0165aebb2700000000001ae101faedac5851e32b9b23b5f9411a8c2bac4aae3ed4dd7b811dd1a72ea4aa7100000000023a7e990141555756000000000007421f61000027102086c7b6b2789170929e85729f448eef8cc1966e01005500ec7a775f46379b5e943c3526b1c8d54cd49749176b0b98e02dde68d1bd335c1700000000085d5648000000000001fb21fffffff80000000065aebb270000000065aebb27000000000853e6fd00000000000250830afd186ca195fb66ca2bd28c3cf4723f2915c0accfcb5dc2044cf8297149a0b0cfc934556c8187cde31ef6e7fab09834c22a9914ce96a3e9f3e6cc818c252eea4ace06b4d7938273be8fdb428c954d90bcfc4329a64c186e3e428c0ea6308895238c0e2693498a576249bb4b53236eedbae74d84958fcd7ab8d6214c3b62056901f2dad8585d903dd6d8e4f55038817cb5cf2b2cbb05244d26ddfb1327e4e868de7a0597c0782b3d456eefad038dbf472d0224608b8fdcdbfd18e05fdfb0d807f048242d64cab5450f
- "{
pyth-storage-contract: 'ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-store-v1,
pyth-decoder-contract: 'ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.pyth-pnau-decoder-v1,
wormhole-core-contract: 'ST2T5JKWWP3FYYX4YRK8GK5BG2YCNGEAEY1JKX06E.wormhole-core-v2
}"
cost: 1000000

0 comments on commit af24fd8

Please sign in to comment.