Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeremyletang/uniswap_price_source
A simple contract to pull price from uniswap pool to be used as oracle source price for the vega protocol
https://github.com/jeremyletang/uniswap_price_source
Last synced: 25 days ago
JSON representation
A simple contract to pull price from uniswap pool to be used as oracle source price for the vega protocol
- Host: GitHub
- URL: https://github.com/jeremyletang/uniswap_price_source
- Owner: jeremyletang
- Created: 2024-01-10T16:38:42.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-02-14T13:41:34.000Z (9 months ago)
- Last Synced: 2024-02-14T14:41:57.687Z (9 months ago)
- Language: Solidity
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Uniswap Price Source Contract
This Solidity smart contract provides a set of functions to retrieve prices from Uniswap V3 pools, specifically targeting prices in terms of USDT, USDC, and WETH. The contract is designed to handle various scenarios, including getting prices from different pools and applying multipliers.
## Prerequisites
- Solidity version 0.7.6
- Ethereum network supporting Uniswap V3 contracts
- External dependencies: `v3-core` contracts (imported in the code)## Contract Overview
The contract includes the following key functions:
- `getPriceFromPool`: Get the price of a token in terms of a specified quote token.
- `priceFromEthPoolInUsdt` and `priceFromEthPoolInUsdc`: Get the price of a token in terms of USDT or USDC, with an optional multiplier.
- `ethPriceInUsdt` and `ethPriceInUsdc`: Get the price of ETH in terms of USDT or USDC.
- `priceFromUsdcPool` and `priceFromUsdtPool`: Get the price of a token from an USDC or USDT pool, respectively.
- `priceFromWethPool`: Get the price of a token in terms of WETH.
- `priceFromUsdtPoolInUsdc` and `priceFromUsdcPoolInUsdt`: Get the price of a token in terms of USDC or USDT from a USDT or USDC pool, respectively.
- `usdtPriceInUsdc` and `usdcPriceInUsdt`: Get the price of USDT in terms of USDC or vice versa.## Usage
1. Deploy the contract on an Ethereum network.
2. Call the desired functions based on your price calculation needs.Note: Ensure the contract has sufficient permissions and funds to interact with the Uniswap V3 pools.
## License
This contract is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Disclaimer
This contract is provided as-is without any warranties. Use it at your own risk