Skip to content

Commit

Permalink
feat: implement runbook
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Aug 7, 2024
1 parent b0df9f2 commit d6dd586
Show file tree
Hide file tree
Showing 8 changed files with 539 additions and 21 deletions.
43 changes: 22 additions & 21 deletions Clarinet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,48 @@ authors = []
telemetry = false
cache_dir = './.cache'

[[project.requirements]]
contract_id = 'SP2J933XB2CP2JQ1A4FGN8JA968BBG3NK3EKZ7Q9F.hk-cursor-v2'

[[project.requirements]]
contract_id = 'SP2J933XB2CP2JQ1A4FGN8JA968BBG3NK3EKZ7Q9F.hk-ecc-v1'
[contracts.hk-cursor]
path = 'contracts/requirements/hk-cursor.clar'
clarity_version = 2
epoch = 2.4

[[project.requirements]]
contract_id = 'SP2J933XB2CP2JQ1A4FGN8JA968BBG3NK3EKZ7Q9F.hk-merkle-tree-keccak160-v1'
[contracts.hk-merkle-tree-keccak160]
path = 'contracts/requirements/hk-merkle-tree-keccak160.clar'
clarity_version = 2
epoch = 2.4

[contracts.pyth-governance-v1]
path = 'contracts/pyth-governance-v1.clar'
[contracts.pyth-governance]
path = 'contracts/pyth-governance.clar'
clarity_version = 2
epoch = 2.4

[contracts.pyth-oracle-v2]
path = 'contracts/pyth-oracle-v2.clar'
[contracts.pyth-oracle]
path = 'contracts/pyth-oracle.clar'
clarity_version = 2
epoch = 2.4

[contracts.pyth-store-v1]
path = 'contracts/pyth-store-v1.clar'
[contracts.pyth-store]
path = 'contracts/pyth-store.clar'
clarity_version = 2
epoch = 2.4

[contracts.pyth-pnau-decoder-v1]
path = 'contracts/pyth-pnau-decoder-v1.clar'
[contracts.pyth-pnau-decoder]
path = 'contracts/pyth-pnau-decoder.clar'
clarity_version = 2
epoch = 2.4

[contracts.pyth-traits-v1]
path = 'contracts/pyth-traits-v1.clar'
[contracts.pyth-traits]
path = 'contracts/pyth-traits.clar'
clarity_version = 2
epoch = 2.4

[contracts.wormhole-core-v2]
path = 'contracts/wormhole/wormhole-core-v2.clar'
[contracts.wormhole-core]
path = 'contracts/wormhole/wormhole-core.clar'
clarity_version = 2
epoch = 2.4

[contracts.wormhole-traits-v1]
path = 'contracts/wormhole/wormhole-traits-v1.clar'
[contracts.wormhole-traits]
path = 'contracts/wormhole/wormhole-traits.clar'
clarity_version = 2
epoch = 2.4

Expand Down
49 changes: 49 additions & 0 deletions runbooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# stacks-pyth Runbooks

[![Txtx](https://img.shields.io/badge/Operated%20with-Txtx-gree?labelColor=gray)](https://txtx.sh)

## Runbooks available

### Pyth Deployment
deploy

## Getting Started

This repository is using [txtx](https://txtx.sh) for handling its on-chain operations.

`txtx` takes its inspiration from a battle tested devops best practice named `infrastructure as code`, that have transformed cloud architectures.

`txtx` simplifies and streamlines Smart Contract Infrastructure management across blockchains, focusing on robustness, reproducibility and composability.

### Installation

```console
$ curl -sL https://install.txtx.sh/ | bash
```

### Scaffold a new runbook

```console
$ txtx new
```

Access tutorials and documentation at [docs.txtx.sh](https://docs.txtx.sh) to understand the syntax and discover the powerful features of txtx.

Additionally, the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=txtx.txtx) will make writing runbooks easier.

### List runbooks available in this repository
```console
$ txtx ls
Name ID Description
BNS Multisig bns-multisig Register a BNS name using a multisig wallet
```

### Execute an existing runbook
```console
$ txtx run bns-multisig
```

### Update the README documentation
```console
$ txtx docs --update
```
71 changes: 71 additions & 0 deletions runbooks/deployments/deploy/deploy-contracts.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
runtime "addon::stacks" {
defaults {
network_id = env.stacks_network_id
rpc_api_url = env.stacks_api_url
}
}

wallet "operator" "stacks::mnemonic" {
mnemonic = env.operator_mnemonic
}

action "wormhole_traits_deployment" "stacks::deploy_contract" {
description = "Deploy wormhole-traits contract"
contract = stacks::get_contract_from_clarinet_project("wormhole-traits", env.clarinet_manifest_path)
signer = wallet.operator
confirmations = 1
}

action "pyth_trait_deployment" "stacks::deploy_contract" {
description = "Deploy pyth-traits contract"
contract = stacks::get_contract_from_clarinet_project("pyth-traits", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.wormhole_core_deployment]
}

action "pyth_governance_deployment" "stacks::deploy_contract" {
description = "Deploy pyth-governance contract"
contract = stacks::get_contract_from_clarinet_project("pyth-governance", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.pyth_trait_deployment, action.hk_cursor_deployment]
}

action "pyth_oracle_deployment" "stacks::deploy_contract" {
description = "Deploy pyth-oracle contract"
contract = stacks::get_contract_from_clarinet_project("pyth-oracle", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.pyth_trait_deployment, action.pyth_governance_deployment]
}

action "pyth_pnau_decoder_deployment" "stacks::deploy_contract" {
description = "Deploy pyth-pnau-decoder contract"
contract = stacks::get_contract_from_clarinet_project("pyth-pnau-decoder", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.pyth_trait_deployment, action.hk_merkle_tree_keccak160_deployment, action.pyth_governance_deployment]
}

action "pyth_store_deployment" "stacks::deploy_contract" {
description = "Deploy pyth-store contract"
contract = stacks::get_contract_from_clarinet_project("pyth-store", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.pyth_trait_deployment, action.pyth_governance_deployment]
}

action "wormhole_core_deployment" "stacks::deploy_contract" {
description = "Deploy wormhole-core contract"
contract = stacks::get_contract_from_clarinet_project("wormhole-core", env.clarinet_manifest_path)
signer = wallet.operator
depends_on = [action.wormhole_traits_deployment, action.hk_cursor_deployment]
}

action "hk_cursor_deployment" "stacks::deploy_contract" {
description = "Deploy hk-cursor contract"
contract = stacks::get_contract_from_clarinet_project("hk-cursor", env.clarinet_manifest_path)
signer = wallet.operator
}

action "hk_merkle_tree_keccak160_deployment" "stacks::deploy_contract" {
description = "Deploy hk-merkle-tree-keccak160 contract"
contract = stacks::get_contract_from_clarinet_project("hk-merkle-tree-keccak160", env.clarinet_manifest_path)
signer = wallet.operator
}
70 changes: 70 additions & 0 deletions runbooks/deployments/deploy/deploy-guardians-updates.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
input "update_guardian_set_1_vaa" {
description = "VAA for guardian rotation #1"
value = "0x010000000001007ac31b282c2aeeeb37f3385ee0de5f8e421d30b9e5ae8ba3d4375c1c77a86e77159bb697d9c456d6f8c02d22a94b1279b65b0d6a9957e7d3857423845ac758e300610ac1d2000000030001000000000000000000000000000000000000000000000000000000000000000400000000000005390000000000000000000000000000000000000000000000000000000000436f7265020000000000011358cc3ae5c097b213ce3c81979e1b9f9570746aa5ff6cb952589bde862c25ef4392132fb9d4a42157114de8460193bdf3a2fcf81f86a09765f4762fd1107a0086b32d7a0977926a205131d8731d39cbeb8c82b2fd82faed2711d59af0f2499d16e726f6b211b39756c042441be6d8650b69b54ebe715e234354ce5b4d348fb74b958e8966e2ec3dbd4958a7cdeb5f7389fa26941519f0863349c223b73a6ddee774a3bf913953d695260d88bc1aa25a4eee363ef0000ac0076727b35fbea2dac28fee5ccb0fea768eaf45ced136b9d9e24903464ae889f5c8a723fc14f93124b7c738843cbb89e864c862c38cddcccf95d2cc37a4dc036a8d232b48f62cdd4731412f4890da798f6896a3331f64b48c12d1d57fd9cbe7081171aa1be1d36cafe3867910f99c09e347899c19c38192b6e7387ccd768277c17dab1b7a5027c0b3cf178e21ad2e77ae06711549cfbb1f9c7a9d8096e85e1487f35515d02a92753504a8d75471b9f49edb6fbebc898f403e4773e95feb15e80c9a99c8348d"
}

input "update_guardian_set_2_vaa" {
description = "VAA for guardian rotation #2"
value = "0x01000000010d0012e6b39c6da90c5dfd3c228edbb78c7a4c97c488ff8a346d161a91db067e51d638c17216f368aa9bdf4836b8645a98018ca67d2fec87d769cabfdf2406bf790a0002ef42b288091a670ef3556596f4f47323717882881eaf38e03345078d07a156f312b785b64dae6e9a87e3d32872f59cb1931f728cecf511762981baf48303668f0103cef2616b84c4e511ff03329e0853f1bd7ee9ac5ba71d70a4d76108bddf94f69c2a8a84e4ee94065e8003c334e899184943634e12043d0dda78d93996da073d190104e76d166b9dac98f602107cc4b44ac82868faf00b63df7d24f177aa391e050902413b71046434e67c770b19aecdf7fce1d1435ea0be7262e3e4c18f50ddc8175c0105d9450e8216d741e0206a50f93b750a47e0a258b80eb8fed1314cc300b3d905092de25cd36d366097b7103ae2d184121329ba3aa2d7c6cc53273f11af14798110010687477c8deec89d36a23e7948feb074df95362fc8dcbd8ae910ac556a1dee1e755c56b9db5d710c940938ed79bc1895a3646523a58bc55f475a23435a373ecfdd0107fb06734864f79def4e192497362513171530daea81f07fbb9f698afe7e66c6d44db21323144f2657d4a5386a954bb94eef9f64148c33aef6e477eafa2c5c984c01088769e82216310d1827d9bd48645ec23e90de4ef8a8de99e2d351d1df318608566248d80cdc83bdcac382b3c30c670352be87f9069aab5037d0b747208eae9c650109e9796497ff9106d0d1c62e184d83716282870cef61a1ee13d6fc485b521adcce255c96f7d1bca8d8e7e7d454b65783a830bddc9d94092091a268d311ecd84c26010c468c9fb6d41026841ff9f8d7368fa309d4dbea3ea4bbd2feccf94a92cc8a20a226338a8e2126cd16f70eaf15b4fc9be2c3fa19def14e071956a605e9d1ac4162010e23fcb6bd445b7c25afb722250c1acbc061ed964ba9de1326609ae012acdfb96942b2a102a2de99ab96327859a34a2b49a767dbdb62e0a1fb26af60fe44fd496a00106bb0bac77ac68b347645f2fb1ad789ea9bd76fb9b2324f25ae06f97e65246f142df717f662e73948317182c62ce87d79c73def0dba12e5242dfc038382812cfe00126da03c5e56cb15aeeceadc1e17a45753ab4dc0ec7bf6a75ca03143ed4a294f6f61bc3f478a457833e43084ecd7c985bf2f55a55f168aac0e030fc49e845e497101626e9d9a5d9e343f00010000000000000000000000000000000000000000000000000000000000000004c1759167c43f501c2000000000000000000000000000000000000000000000000000000000436f7265020000000000021358cc3ae5c097b213ce3c81979e1b9f9570746aa5ff6cb952589bde862c25ef4392132fb9d4a42157114de8460193bdf3a2fcf81f86a09765f4762fd1107a0086b32d7a0977926a205131d8731d39cbeb8c82b2fd82faed2711d59af0f2499d16e726f6b211b39756c042441be6d8650b69b54ebe715e234354ce5b4d348fb74b958e8966e2ec3dbd4958a7cd66b9590e1c41e0b226937bf9217d1d67fd4e91f574a3bf913953d695260d88bc1aa25a4eee363ef0000ac0076727b35fbea2dac28fee5ccb0fea768eaf45ced136b9d9e24903464ae889f5c8a723fc14f93124b7c738843cbb89e864c862c38cddcccf95d2cc37a4dc036a8d232b48f62cdd4731412f4890da798f6896a3331f64b48c12d1d57fd9cbe7081171aa1be1d36cafe3867910f99c09e347899c19c38192b6e7387ccd768277c17dab1b7a5027c0b3cf178e21ad2e77ae06711549cfbb1f9c7a9d8096e85e1487f35515d02a92753504a8d75471b9f49edb6fbebc898f403e4773e95feb15e80c9a99c8348d"
}

input "update_guardian_set_3_vaa" {
description = "VAA for guardian rotation #3"
value = "0x01000000020d00ce45474d9e1b1e7790a2d210871e195db53a70ffd6f237cfe70e2686a32859ac43c84a332267a8ef66f59719cf91cc8df0101fd7c36aa1878d5139241660edc0010375cc906156ae530786661c0cd9aef444747bc3d8d5aa84cac6a6d2933d4e1a031cffa30383d4af8131e929d9f203f460b07309a647d6cd32ab1cc7724089392c000452305156cfc90343128f97e499311b5cae174f488ff22fbc09591991a0a73d8e6af3afb8a5968441d3ab8437836407481739e9850ad5c95e6acfcc871e951bc30105a7956eefc23e7c945a1966d5ddbe9e4be376c2f54e45e3d5da88c2f8692510c7429b1ea860ae94d929bd97e84923a18187e777aa3db419813a80deb84cc8d22b00061b2a4f3d2666608e0aa96737689e3ba5793810ff3a52ff28ad57d8efb20967735dc5537a2e43ef10f583d144c12a1606542c207f5b79af08c38656d3ac40713301086b62c8e130af3411b3c0d91b5b50dcb01ed5f293963f901fc36e7b0e50114dce203373b32eb45971cef8288e5d928d0ed51cd86e2a3006b0af6a65c396c009080009e93ab4d2c8228901a5f4525934000b2c26d1dc679a05e47fdf0ff3231d98fbc207103159ff4116df2832eea69b38275283434e6cd4a4af04d25fa7a82990b707010aa643f4cf615dfff06ffd65830f7f6cf6512dabc3690d5d9e210fdc712842dc2708b8b2c22e224c99280cd25e5e8bfb40e3d1c55b8c41774e287c1e2c352aecfc010b89c1e85faa20a30601964ccc6a79c0ae53cfd26fb10863db37783428cd91390a163346558239db3cd9d420cfe423a0df84c84399790e2e308011b4b63e6b8015010ca31dcb564ac81a053a268d8090e72097f94f366711d0c5d13815af1ec7d47e662e2d1bde22678113d15963da100b668ba26c0c325970d07114b83c5698f46097010dc9fda39c0d592d9ed92cd22b5425cc6b37430e236f02d0d1f8a2ef45a00bde26223c0a6eb363c8b25fd3bf57234a1d9364976cefb8360e755a267cbbb674b39501108db01e444ab1003dd8b6c96f8eb77958b40ba7a85fefecf32ad00b7a47c0ae7524216262495977e09c0989dd50f280c21453d3756843608eacd17f4fdfe47600001261025228ef5af837cb060bcd986fcfa84ccef75b3fa100468cfd24e7fadf99163938f3b841a33496c2706d0208faab088bd155b2e20fd74c625bb1cc8c43677a0163c53c409e0c5dfa000100000000000000000000000000000000000000000000000000000000000000046c5a054d7833d1e42000000000000000000000000000000000000000000000000000000000436f7265020000000000031358cc3ae5c097b213ce3c81979e1b9f9570746aa5ff6cb952589bde862c25ef4392132fb9d4a42157114de8460193bdf3a2fcf81f86a09765f4762fd1107a0086b32d7a0977926a205131d8731d39cbeb8c82b2fd82faed2711d59af0f2499d16e726f6b211b39756c042441be6d8650b69b54ebe715e234354ce5b4d348fb74b958e8966e2ec3dbd4958a7cd15e7caf07c4e3dc8e7c469f92c8cd88fb8005a2074a3bf913953d695260d88bc1aa25a4eee363ef0000ac0076727b35fbea2dac28fee5ccb0fea768eaf45ced136b9d9e24903464ae889f5c8a723fc14f93124b7c738843cbb89e864c862c38cddcccf95d2cc37a4dc036a8d232b48f62cdd4731412f4890da798f6896a3331f64b48c12d1d57fd9cbe7081171aa1be1d36cafe3867910f99c09e347899c19c38192b6e7387ccd768277c17dab1b7a5027c0b3cf178e21ad2e77ae06711549cfbb1f9c7a9d8096e85e1487f35515d02a92753504a8d75471b9f49edb6fbebc898f403e4773e95feb15e80c9a99c8348d"
}

input "update_guardian_set_4_vaa" {
description = "VAA for guardian rotation #4"
value = "0x01000000030d03d4a37a6ff4361d91714730831e9d49785f61624c8f348a9c6c1d82bc1d98cadc5e936338204445c6250bb4928f3f3e165ad47ca03a5d63111168a2de4576856301049a5df10464ea4e1961589fd30fc18d1970a7a2ffaad617e56a0f7777f25275253af7d10a0f0f2494dc6e99fc80e444ab9ebbbee252ded2d5dcb50cbf7a54bb5a01055f4603b553b9ba9e224f9c55c7bca3da00abb10abd19e0081aecd3b352be061a70f79f5f388ebe5190838ef3cd13a2f22459c9a94206883b739c90b40d5d74640006a8fade3997f650a36e46bceb1f609edff201ab32362266f166c5c7da713f6a19590c20b68ed3f0119cb24813c727560ede086b3d610c2d7a1efa66f655bad90900080f5e495a75ea52241c59d145c616bfac01e57182ad8d784cbcc9862ed3afb60c0983ccbc690553961ffcf115a0c917367daada8e60be2cbb8b8008bac6341a8c010935ab11e0eea28b87a1edc5ccce3f1fac25f75b5f640fe6b0673a7cd74513c9dc01c544216cf364cc9993b09fda612e0cd1ced9c00fb668b872a16a64ebb55d27010ab2bc39617a2396e7defa24cd7c22f42dc31f3c42ffcd9d1472b02df8468a4d0563911e8fb6a4b5b0ce0bd505daa53779b08ff660967b31f246126ed7f6f29a7e000bdb6d3fd7b33bdc9ac3992916eb4aacb97e7e21d19649e7fa28d2dd6e337937e4274516a96c13ac7a8895da9f91948ea3a09c25f44b982c62ce8842b58e20c8a9000d3d1b19c8bb000856b6610b9d28abde6c35cb7705c6ca5db711f7be96d60eed9d72cfa402a6bfe8bf0496dbc7af35796fc768da51a067b95941b3712dce8ae1e7010ec80085033157fd1a5628fc0c56267469a86f0e5a66d7dede1ad4ce74ecc3dff95b60307a39c3bfbeedc915075070da30d0395def9635130584f709b3885e1bdc0010fc480eb9ee715a2d151b23722b48b42581d7f4001fc1696c75425040bfc1ffc5394fe418adb2b64bd3dc692efda4cc408163677dbe233b16bcdabb853a20843301118ee9e115e1a0c981f19d0772b850e666591322da742a9a12cce9f52a5665bd474abdd59c580016bee8aae67fdf39b315be2528d12eec3a652910e03cc4c6fa3801129d0d1e2e429e969918ec163d16a7a5b2c6729aa44af5dccad07d25d19891556a79b574f42d9adbd9e2a9ae5a6b8750331d2fccb328dd94c3bf8791ee1bfe85aa00661e99781981faea00010000000000000000000000000000000000000000000000000000000000000004fd4c6c55ec8dfd342000000000000000000000000000000000000000000000000000000000436f726502000000000004135893b5a76c3f739645648885bdccc06cd70a3cd3ff6cb952589bde862c25ef4392132fb9d4a42157114de8460193bdf3a2fcf81f86a09765f4762fd1107a0086b32d7a0977926a205131d8731d39cbeb8c82b2fd82faed2711d59af0f2499d16e726f6b211b39756c042441be6d8650b69b54ebe715e234354ce5b4d348fb74b958e8966e2ec3dbd4958a7cd15e7caf07c4e3dc8e7c469f92c8cd88fb8005a2074a3bf913953d695260d88bc1aa25a4eee363ef0000ac0076727b35fbea2dac28fee5ccb0fea768eaf45ced136b9d9e24903464ae889f5c8a723fc14f93124b7c738843cbb89e864c862c38cddcccf95d2cc37a4dc036a8d232b48f62cdd4731412f4890da798f6896a3331f64b48c12d1d57fd9cbe7081171aa1be1d36cafe3867910f99c09e347899c19c38192b6e7387ccd768277c17dab1b7a5027c0b3cf178e21ad2e77ae06711549cfbb1f9c7a9d8096e85e1487f35515d02a92753504a8d75471b9f49edb6fbebc898f403e4773e95feb15e80c9a99c8348d"
}

action "update_guardian_set_1" "stacks::send_contract_call" {
// The address and identifier of the contract to invoke.
contract_id = action.wormhole_core_deployment.contract_id
// The contract method to invoke.
function_name = "update-guardians-set"
// The function arguments for the contract call.
function_args = [input.update_guardian_set_1_vaa, input.guardian_set_1]
// A reference to a wallet construct, which will be used to sign the transaction payload.
signer = wallet.operator
fee = 20000
}

action "update_guardian_set_2" "stacks::send_contract_call" {
// The address and identifier of the contract to invoke.
contract_id = action.wormhole_core_deployment.contract_id
// The contract method to invoke.
function_name = "update-guardians-set"
// The function arguments for the contract call.
function_args = [input.update_guardian_set_2_vaa, input.guardian_set_2]
// A reference to a wallet construct, which will be used to sign the transaction payload.
signer = wallet.operator
depends_on = [action.update_guardian_set_1]
fee = 20000
}

action "update_guardian_set_3" "stacks::send_contract_call" {
// The address and identifier of the contract to invoke.
contract_id = action.wormhole_core_deployment.contract_id
// The contract method to invoke.
function_name = "update-guardians-set"
// The function arguments for the contract call.
function_args = [input.update_guardian_set_3_vaa, input.guardian_set_3]
// A reference to a wallet construct, which will be used to sign the transaction payload.
signer = wallet.operator
depends_on = [action.update_guardian_set_2]
fee = 20000
}

action "update_guardian_set_4" "stacks::send_contract_call" {
// The address and identifier of the contract to invoke.
contract_id = action.wormhole_core_deployment.contract_id
// The contract method to invoke.
function_name = "update-guardians-set"
// The function arguments for the contract call.
function_args = [input.update_guardian_set_4_vaa, input.guardian_set_4]
// A reference to a wallet construct, which will be used to sign the transaction payload.
signer = wallet.operator
depends_on = [action.update_guardian_set_3]
fee = 20000
}
Loading

0 comments on commit d6dd586

Please sign in to comment.