{"id":29465848,"url":"https://github.com/buildwithcode888/golang-pricefeed","last_synced_at":"2025-08-30T18:19:21.917Z","repository":{"id":292663580,"uuid":"925027279","full_name":"buildwithcode888/Golang-pricefeed","owner":"buildwithcode888","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-31T04:45:41.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-14T09:04:58.229Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/buildwithcode888.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-31T04:44:27.000Z","updated_at":"2025-01-31T04:45:45.000Z","dependencies_parsed_at":"2025-05-11T12:55:00.077Z","dependency_job_id":"a4e5bfd2-7d04-4735-9858-7944f2628443","html_url":"https://github.com/buildwithcode888/Golang-pricefeed","commit_stats":null,"previous_names":["buildwithcode888/golang-pricefeed"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/buildwithcode888/Golang-pricefeed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildwithcode888%2FGolang-pricefeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildwithcode888%2FGolang-pricefeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildwithcode888%2FGolang-pricefeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildwithcode888%2FGolang-pricefeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buildwithcode888","download_url":"https://codeload.github.com/buildwithcode888/Golang-pricefeed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buildwithcode888%2FGolang-pricefeed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272886575,"owners_count":25009853,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-07-14T08:21:04.944Z","updated_at":"2025-08-30T18:19:21.880Z","avatar_url":"https://github.com/buildwithcode888.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting an asset price from EVM chain\n\n## Table of Contents\n\n- [About The Project](#about-the-project)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## About The Project\n\nThe project shows how to retrieve asset price from any EVM chain. The price data feed contract addresses can be found [here](https://docs.chain.link/docs/reference-contracts/).\n\n\u003e 📘 Note on `Go` bindings [`aggregator_v3_interface.go`](aggregatorv3/aggregator_v3_interface.go)\n\u003e\n\u003e Follow these steps to learn how to generate this file:\n\u003e\n\u003e 1. Generate the [Contract ABI](https://docs.soliditylang.org/en/latest/abi-spec.html) from a solidity source file using [solc](https://docs.soliditylang.org/en/latest/using-the-compiler.html). In this case, we are going to download the [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol) and generate an ABI called `AggregatorV3Interface.abi`:\n\u003e\n\u003e ```shell\n\u003e cd aggregatorv3\n\u003e wget https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\n\u003e ```\n\u003e\n\u003e ```shell\n\u003e solc --abi AggregatorV3Interface.sol -o .\n\u003e ```\n\u003e\n\u003e 2. From `AggregatorV3Interface.abi`, generate the `Go` bindings `aggregator_v3_interface.go` required to programmatically interact with a smart contract \u003e using generated, typesafe `Go`code. Ensure that [Geth](https://geth.ethereum.org/docs/install-and-build/installing-geth) is installed so you can use \u003e \u003e \u003e [`abigen`](https://geth.ethereum.org/docs/dapp/native-bindings).\n\u003e\n\u003e ```shell\n\u003e abigen --abi=AggregatorV3Interface.abi --pkg=aggregator_v3_interface --out=aggregator_v3_interface.go\n\u003e ```\n\n## Prerequisites\n\n- [Go](https://go.dev/doc/install)\n- Be familiar with [Chainlink Data Feeds](https://docs.chain.link/docs/get-the-latest-price/) and [Chainlink Data Feeds Contract Addresses](https://docs.chain.link/docs/reference-contracts/).\n\n## Installation\n\n1. Get a RPC API Key from a node provider such as [Alchemy](https://www.alchemy.com/), [Infura](https://infura.io/), [Moralis](https://moralis.io/), or [QuickNode](https://www.quicknode.com/). This example uses the Rinkeby testnet.\n1. Clone the repo\n   ```sh\n   git clone https://github.com/smartcontractkit/smart-contract-examples.git\n   ```\n1. Enter the directory\n   ```sh\n   cd pricefeed-golang\n   ```\n1. Copy the example environment file `.env.example` to create `.env` file\n   ```sh\n   cp .env.example .env\n   ```\n1. In `.env` file , replace `REPLACE_BY_YOUR_RPC_URL` by the RPC_URL of the EVM chain you want to connect to.\n1. In `.env` file , replace `REPLACE_BY_PRICE_FEED_PROXY_ADDR` by the price feed address. For instance, `0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419` if you want the `ETH/USD` price feed on the Ethereum mainnet.\n\n## Usage\n\nAfter the installation step, run the example\n\n```sh\ngo run main.go\n```\n\nExample:\n\n```sh\ngo run main.go\n\n2024/03/06 16:52:38 ETH / USD Price feed address is  0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n2024/03/06 16:52:38 Round id is 110680464442257322577\n2024/03/06 16:52:38 Answer is 379607523254\n2024/03/06 16:52:38 Formatted answer is 3796.07523254\n2024/03/06 16:52:38 Started at 2024-03-06 16:31:11 +0100 CET\n2024/03/06 16:52:38 Updated at 2024-03-06 16:31:11 +0100 CET\n2024/03/06 16:52:38 Answered in round 110680464442257322577\n```\n\nNote that you can also override the price feed address on the command line. For instance:\n\n```sh\ngo run main.go 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n```\n\nExample:\n\n```sh\ngo run main.go 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n\n2024/03/06 16:53:07 ETH / USD Price feed address is  0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n2024/03/06 16:53:07 Round id is 110680464442257322577\n2024/03/06 16:53:07 Answer is 379607523254\n2024/03/06 16:53:07 Formatted answer is 3796.07523254\n2024/03/06 16:53:07 Started at 2024-03-06 16:31:11 +0100 CET\n2024/03/06 16:53:07 Updated at 2024-03-06 16:31:11 +0100 CET\n2024/03/06 16:53:07 Answered in round 110680464442257322577\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildwithcode888%2Fgolang-pricefeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuildwithcode888%2Fgolang-pricefeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuildwithcode888%2Fgolang-pricefeed/lists"}