{"id":19107542,"url":"https://github.com/smartcontractkit/chainlink-terra-feeds-demo","last_synced_at":"2025-04-18T21:32:27.721Z","repository":{"id":41827695,"uuid":"418743323","full_name":"smartcontractkit/chainlink-terra-feeds-demo","owner":"smartcontractkit","description":"Showing how to deploy a Terra smart contract which utilizes Chainlink Data Feeds","archived":false,"fork":false,"pushed_at":"2022-04-27T19:41:52.000Z","size":231,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-08-04T16:38:21.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcontractkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-19T02:37:11.000Z","updated_at":"2022-08-22T12:25:17.000Z","dependencies_parsed_at":"2022-08-11T18:40:51.424Z","dependency_job_id":null,"html_url":"https://github.com/smartcontractkit/chainlink-terra-feeds-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fchainlink-terra-feeds-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fchainlink-terra-feeds-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fchainlink-terra-feeds-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fchainlink-terra-feeds-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcontractkit","download_url":"https://codeload.github.com/smartcontractkit/chainlink-terra-feeds-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783060,"owners_count":17201915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T04:12:57.141Z","updated_at":"2024-11-09T04:12:57.206Z","avatar_url":"https://github.com/smartcontractkit.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chainlink Terra\n\n## Developing\n\n### Requirements\n\nThis demo requires the following components:\n\n- Rust:\n  - [`rustup`](https://rustup.rs/) with `cargo` 1.44.1+.\n  - [`rustc`](https://www.rust-lang.org/tools/install) and `cargo` 1.44.1+.\n  - Install the `wasm32-unknown-unknown` target for Rust: `rustup target add wasm32-unknown-unknown`\n- [NodeJS](https://nodejs.org/en/) 14 LTS or later.\n- [Docker](https://www.docker.com/)\n- A C compiler such as the one included in [GCC](https://gcc.gnu.org/install/).\n\nConfirm that the necessary requirements are installed:\n\n```sh\nrustc --version\ncargo --version\nrustup target list --installed\ndocker --version\nnode --version\n```\n\n### Compile a contract\n\nExample contracts are available in the `./contracts` directory of this\nrepository. Make sure you can compile and run the contracts before making\nany changes. From the base of your cloned repository, run `cargo wasm` to\nproduce a wasm build for each contract:\n\n```sh\ncargo wasm\n```\n\nThis produces a `.wasm` build file in the\n`./target/wasm32-unknown-unknown/release/` directory for each\ncontract.\n\n### Preparing the Wasm bytecode for production\n\nBefore we upload it to a chain, we need to ensure the smallest output size\npossible, as this will be included in the body of a transaction. We also want\nto have a reproducible build process, so third parties can verify that the\nuploaded Wasm code did indeed come from the claimed rust code.\n\nTo do this, use the following `rust-optimizer`\n(or to be specific in our case - `workspace-optimizer`), a docker image to\nproduce an extremely small build output in a consistent manner. From the\nbase of your cloned repository, run the `workspace-optimizer` container:\n\n```sh\ndocker run --rm -v \"$(pwd)\":/code \\\n  --mount type=volume,source=\"$(basename \"$(pwd)\")_cache\",target=/code/target \\\n  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \\\n  cosmwasm/workspace-optimizer:0.11.4\n```\n\nThis produces an `./artifacts` directory in the root of the workspace. It contains the compiled and optimized WebAssembly output of the contracts along with a Sha256 checksum in `./artifacts/checksums.txt`.\n\n\n### Deploying and Instantiating Price Consumer Contract, and Reading the Latest Price\n\nThis example uses the `readLatestPrice.mjs` script to deploy, instantiate,\nand read the Price Consumer Contract.\n\nInstall the [Terra.js](https://terra-money.github.io/terra.js/#installation)\npackage, which supports several wallet functions in the script:\n\n```sh\nnpm install @terra-money/terra.js\n```\n\nExport your wallet seed phrase to the TERRA_SEED environment variable.\nThe script uses the seed phrase to determine the wallet key that you want\nto use to deploy and call the smart contract.\n\n```sh\nexport TERRA_SEED=\"YOUR SEED PHRASE\"\n```\n\nRun the script:\n\n```sh\nnode ./scripts/readLatestPrice.mjs\n```\n\nAfter the script runs, the price consumer contract should be deployed and\ninstantiated on the Terra testnet. The console prints the\nlatest LUNA/USD price.\n\n```\n{\n  round_data_response: {\n    round_id: 39516,\n    answer: '3706000000',\n    started_at: 1634497952,\n    updated_at: 1634497952,\n    answered_in_round: 39516\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fchainlink-terra-feeds-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcontractkit%2Fchainlink-terra-feeds-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fchainlink-terra-feeds-demo/lists"}