The 1inch spot price aggregator is a set of smart contracts that extract price data for tokens traded on DEXes from the blockchain. To avoid price manipulations within a transaction, the spot price aggregator should ONLY be used off-chain. DO NOT use it on-chain. For off-chain usage see Examples section below.
To handle wrapped tokens, such as wETH, cDAI, aDAI etc., the 1inch spot price aggregator uses custom wrapper smart contracts that wrap/unwrap tokens at the current wrapping exchange rate.
If no direct liquidity pair exists between two tokens, the spot price aggregator calculates rates for those coins using another token that has pairs with both of them – a connector token.
Supported DEXes
- Chainlink - 0x8606321723D9cA7db708A8b12DAd0A8a83f2F3bD
- KyberDMM - 0xE2d0e58302d03F703BD3c5EC2899F4e1af65E18c
- Mooniswap - 0x5F6a6428756CfAF96584286Ef9f7411621196f3A
- Synthetix - 0xb7EF687B322910f3315F91f9F4B9b4B77219ddb4
- Uniswap - 0xAdF7CC69626eB6F03F4F613832C84Cf62586A6Bb
- Equalizer - 0xEBA383DA9FCe0Ea0acB59A185A73D48dC089c73F
- ShibaSwap - 0x0fE8bD9CB73ADC66561330B648a8fC62b4F58943
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- UniswapV2 - 0xA21E47477DE9BbcDC962ee18a5E7D339c5a16D28
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- Curve - 0x7eE5d607597598e9d642b264b7Ac2703b92Acf9B
- Pancake 3 - 0xB4039b37d09772801a51764537c167445f52F48b
- Dodo - 0x0A7c4d89e1629f189Eb12dd716B178d1b90D9f66
- DodoV2 - 0x03aA019F3B78110e030c34e9fA98047A1f62859A
Supported wrappers
- WETH - 0x2b36053EB3BC1D68f51Bb7916D1503D1556f3ffc
- AaveV1 - 0x8C00a411Fe8983525F82CFCe34fe4B092d9E525d
- AaveV2 - 0x06cC74503B6d1eB6D4d6Bc402f48fC07b804105f
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- Compound - 0x7C327E1Ee66d4cF7F4053387241351FDc95A0c04
- CompoundV3 - 0xd24222B521337DABE4f1e56d351818fbf26905eD
- YVault - 0x9FF110f132d988bfa9bC6a21851Da1aF3aC6EaF8
- stETH - 0x26daCf7E879b18FE658326ddD3ABC0D6910B3E9F
- wstETH - 0x37eB78fE793E89353e46AEe73E299985C3B8d334
- sDAI - 0xF07317368A4B061dadB8C8239cbfCfd4808B76ce
- CHAI - 0x6fE4926a0fCc78ab764b39f2738e1Dea145d7AC0
Supported connectors
- ETH - 0x0000000000000000000000000000000000000000
- WETH - 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
- USDC - 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
- DAI - 0x6B175474E89094C44Da98b954EedeAC495271d0F
- USDT - 0xdAC17F958D2ee523a2206206994597C13D831ec7
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- WBTC - 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
- 3CRV - 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490
Prev oracle versions (legacy)
- May-28-2021 - 0x07D91f5fb9Bf7798734C3f606dB065549F6893bb
- Apr-07-2023 - 0x3E1Fe1Bd5a5560972bFa2D393b9aC18aF279fF56
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- ApeSwap - 0xeD55d76Bb48E042a177d1E21AffBe1B72d0c7dB0
- BakerySwap - 0x82b6B75F5fEabbfD370D45daCEFae3D5c06099DA
- BSCswap - 0xD4eFb5998DFBDFB791182fb610D0061136E9DB50
- Demax - 0x7bdc6954e1c7869B4147A320d589689F628E9921
- KyberDMM - 0xE2d0e58302d03F703BD3c5EC2899F4e1af65E18c
- Mooniswap - 0x5F6a6428756CfAF96584286Ef9f7411621196f3A
- Pancake 1 - 0x1b947aF8b3dd6aa96F8726cd92c894D0Ba6367a3
- Pancake 2 - 0xB9fa95a38D50c5Bad1eA2b4E85e106Fe886cCb3A
- Pancake 3 - 0xB4039b37d09772801a51764537c167445f52F48b
- Thugswap - 0x7bBc0156c31A19097eEd6B636AA2F4AB8A31BFD9
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
Supported wrappers
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- Venus - 0x11DEE30E710B8d4a8630392781Cc3c0046365d4c
- WBNB - 0x54431918cec22932fcf97e54769f4e00f646690f
Supported connectors
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- WBNB - 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
- DAI - 0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3
- ETH - 0x2170Ed0880ac9A755fd29B2688956BD959F933F8
- USDC - 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d
- BSC-USD - 0x55d398326f99059fF775485246999027B3197955
- BUSD - 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56
- 1INCH - 0x111111111117dC0aa78b770fA6A738034120C302
Prev oracle versions (legacy)
- May-28-2021 - 0xfbD61B037C325b959c0F6A7e69D8f37770C2c550
- Apr-06-2023 - 0x27950ecAeBB4462e18e8041AAF6Ea13cA47Af001
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- QuickSwap - 0xeec05e0D8F7D3f56CECE2026Feaf41b09B423790
- ComethSwap - 0x11BFd590f592457b65Eb85327F5938141f61878a
- DFYN - 0xeD55d76Bb48E042a177d1E21AffBe1B72d0c7dB0
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- Curve - 0x0bA0D1B119d8a8E193e2802c2C7Ef1BDfAdddc49
Supported wrappers
- WMATIC - 0xA0446D8804611944F1B527eCD37d7dcbE442caba
- AaveV2 - 0x138CE40d675F9a23E4D6127A8600308Cf7A93381
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- CompoundV3 - 0xAc63D130525c251EbB24E010c2959a98c80B993a
Supported connectors
- MATIC - 0x0000000000000000000000000000000000000000
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- WMATIC - 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
- USDC - 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
- USDT - 0xc2132D05D31c914a87C6611C10748AEb04B58e8F
- WETH - 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619
Prev oracle versions (legacy)
- May-28-2021 - 0x7F069df72b7A39bCE9806e3AfaF579E54D8CF2b9
- Apr-05-2023 - 0xf023D71EfB08339EA28F0C186AE130c74D44C58c
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- Velodrome Finance - 0x52a8193C7f42b75F27e4ce96f8ddBA7e854453Ef
- VelodromeV2 - 0xD4eFb5998DFBDFB791182fb610D0061136E9DB50
- Synthetix - 0xb7EF687B322910f3315F91f9F4B9b4B77219ddb4
- Slipstream - 0xeD55d76Bb48E042a177d1E21AffBe1B72d0c7dB0
- Curve - 0x0bA0D1B119d8a8E193e2802c2C7Ef1BDfAdddc49
Supported wrappers
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- // todo: add BaseCoinWrapper
Supported connectors
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- WETH - 0x4200000000000000000000000000000000000006
- USDC.e - 0x7F5c764cBc14f9669B88837ca1490cCa17c31607
- USDC - 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85
- USDT - 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58
- DAI - 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
- WBTC - 0x68f180fcCe6836688e9084f035309E29Bf0A2095
- OP - 0x4200000000000000000000000000000000000042
Prev oracle versions (legacy)
- May-28-2021 - 0x11DEE30E710B8d4a8630392781Cc3c0046365d4c
- Apr-06-2023 - 0x59Bc892E1832aE86C268fC21a91fE940830a52b0
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- DXswap - 0xc197Ab9d47206dAf739a47AC75D0833fD2b0f87F
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- Curve - 0x0bA0D1B119d8a8E193e2802c2C7Ef1BDfAdddc49
Supported wrappers
- WETH - 0x0F85A912448279111694F4Ba4F85dC641c54b594
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- CompoundV3 - 0x04098C93b15E5Cbb5A49651f20218C85F202Cd27
Supported connectors
Prev oracle versions (legacy)
- Sep-14-2021 - 0x735247fb0a604c0adC6cab38ACE16D0DbA31295F
- Apr-03-2023 - 0x59Bc892E1832aE86C268fC21a91fE940830a52b0
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- Joe - 0xc197Ab9d47206dAf739a47AC75D0833fD2b0f87F
- Pangolin - 0xE93293A6088d3a8abDDf62e6CA1A085Cec97D06F
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- Curve - 0x715C0357F8F29FB7a71acDcaeFdde2B964824B23
Supported wrappers
- WAVAX - 0x046605839c01C54921f4aA1AAa245E88227707D8
- AaveV2 - 0x8Aa57827C3D147E39F1058517939461538D9C56A
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
Supported connectors
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- AVAX - 0x0000000000000000000000000000000000000000
- WAVAX - 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7
- WETH.e - 0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB
- USDT.e - 0xc7198437980c041c805A1EDcbA50c1Ce5db95118
- WBTC.e - 0x50b7545627a5162F82A992c33b87aDc75187B218
- USDC.e - 0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664
- USDC - 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
Prev oracle versions (legacy)
- Dec-23-2021 - 0xBd0c7AaF0bF082712EbE919a9dD94b2d978f79A9
- Apr-03-2023 - 0xf023D71EfB08339EA28F0C186AE130c74D44C58c
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- Honeyswap - 0xE93293A6088d3a8abDDf62e6CA1A085Cec97D06F
- Levinswap - 0x52a8193C7f42b75F27e4ce96f8ddBA7e854453Ef
- Swapr - 0x27950ecAeBB4462e18e8041AAF6Ea13cA47Af001
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- Curve - 0x587D67870CF6e733F2Ac101eD83675d6C01Ae127
Supported wrappers
- WXDAI - 0xB89A664FdAf504CDc7826B97Ba6e522d9b78dbE7
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
Supported connectors
- XDAI - 0x0000000000000000000000000000000000000000
- WXDAI - 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d
- NONE - 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
- WETH - 0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1
- HNY - 0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9
- USDC - 0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83
- USDT - 0x4ECaBa5870353805a9F068101A40E0f32ed605C6
Prev oracle versions (legacy)
- Dec-23-2021 - 0x142DB045195CEcaBe415161e1dF1CF0337A4d02E
- Apr-06-2023 - 0x3Ce81621e674Db129033548CbB9FF31AEDCc1BF6
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- Solidex - 0x3Ce81621e674Db129033548CbB9FF31AEDCc1BF6
- SpiritSwap - 0xc197Ab9d47206dAf739a47AC75D0833fD2b0f87F
- Spooky - 0xE93293A6088d3a8abDDf62e6CA1A085Cec97D06F
- SushiSwap - 0x2A45d538f460DDBEeA3a899b0674dA3DFE318faa
- Curve - 0x0bA0D1B119d8a8E193e2802c2C7Ef1BDfAdddc49
Supported wrappers
Supported connectors
Prev oracle versions (legacy)
- Mar-21-2022 - 0xE8E598A1041b6fDB13999D275a202847D9b654ca
- Apr-04-2023 - 0xFdCB8fA524f84081988e6065Fc8EF060f2CF0C27
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- Trisolaris - 0xD4eFb5998DFBDFB791182fb610D0061136E9DB50
- WannaSwap - 0x7bdc6954e1c7869B4147A320d589689F628E9921
- NearPAD - 0x3E1Fe1Bd5a5560972bFa2D393b9aC18aF279fF56
- AuroraSwap - 0xd8C7661C2bA6E9732613C15780f9fBBD55d8bf9c
- Dodo - 0x0A7c4d89e1629f189Eb12dd716B178d1b90D9f66
- DodoV2 - 0x03aA019F3B78110e030c34e9fA98047A1f62859A
- Curve - 0x0bA0D1B119d8a8E193e2802c2C7Ef1BDfAdddc49
Supported wrappers
Supported connectors
Prev oracle versions (legacy)
- May-26-2022 - 0xE4E0552452e5cC1306A2bF5B2Fd9b1eA19418795
- Mar-31-2023 - 0xeD55d76Bb48E042a177d1E21AffBe1B72d0c7dB0
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- KlaySwap - 0xf023D71EfB08339EA28F0C186AE130c74D44C58c
- ClaimSwap - 0xFdCB8fA524f84081988e6065Fc8EF060f2CF0C27
Supported wrappers
Supported connectors
Prev oracle versions (legacy)
- Aug-02-2022 - 0x138CE40d675F9a23E4D6127A8600308Cf7A93381
- Apr-06-2023 - 0x89314d57A8A4E636A00922ac289BC3a9a69C4361
- Jul-13-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
Supported DEXes
- MuteSwitch - 0xE0C1daF04Ca9f65c45bF67E87F6135fcf51ba5D1
- Syncswap - 0x226b15358e2DF022ada190fc3Ac4a32ea26C18c8
Supported wrappers
Supported connectors
Prev oracle versions (legacy)
- Mar-28-2023 - 0x1ec0a5F6dc07E93491426d5aAAc3E2BC505Ef41C
- Jun-05-2023 - 0xEE053a8333B7F804bE050B3D73289C6dbbEB2BFd
- Jul-12-2023 - 0xC762d56614D3411eC6fABD56cb075D904b801613
Supported DEXes
- BaseSwap - 0xb57CdEC62Df2AA93AC4C2449Eb50eB4d2f264f3e
- RocketSwap - 0x3EB7BFE1217b97d19e740C3587f2b12D00abc0Bc
- SwapBased - 0xA57eE57aa7af7c43265A8376c3d54543Cc78C089
- DackieSwap - 0x48f0E5C5A5f5E5d49f3EaF8f5E242C7550629544
- HorizonDex - 0xcdEee819aEf73511331522552Ca1E54e771D40ed
- SushiSwapV3 - 0xf71502f807C37A5aD9bB50aA983423907647bF96
- UniswapV2 - 0x4C5B9573dE7660c097F1a21050038378CD691066
- UniswapV3 - 0xE85B42805e046D1933EB8e1C543C4da4E5e8fFa3
- VelocimeterV2 - 0x26daCf7E879b18FE658326ddD3ABC0D6910B3E9F
- Aerodrome - 0xFd1d18173D2f179a45Bf21F755a261AAe7C2d769
Supported wrappers
- WETH - 0x3Ce81621e674Db129033548CbB9FF31AEDCc1BF6
- AaveV3 - 0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573
- StataTokens (AaveV3) - 0x1A75DF59f464a70Cc8f7383983852FF72e5F5167
- CompoundV3 - 0x3afA12cf9Ac1a96845973BD93dBEa183A94DD74F
Supported connectors
Prev oracle versions (legacy)
- Aug-09-2023 - 0x52cbE0f49CcdD4Dc6E9C13BAb024EABD2842045B
This section provides a comprehensive guide on deploying an oracle, including the nuances of script parameters and additional setup steps. Follow these steps to ensure accurate and reliable oracle deployment for price data retrieval.
- Identify DEXes with Sufficient Liquidity: Begin by surveying the network for Decentralized Exchanges (DEXes) that offer sufficient liquidity. This ensures the oracle can retrieve reliable and accurate price data.
- Select Supported DEXes: Choose DEXes that are supported by
SpotPriceAggregator
or are forks of supported protocols. Supported DEXes can be found in thecontracts/oracles/
directory of the project.
- Configure the Network Settings:
- Skip this step if your network is supported. This can be checked by observing whether the network is mentioned (registered or not) during a test run, visible in the console output. This verification can be done also by reviewing the
registerAll
method in theNetworks
class. If your network is listed there, it's considered supported, and no further action is required for registration in this step. - Update the Hardhat settings file to configure the network.
- Utilize the
Networks
class from solidity-utils for network registration. - Example configuration snippet:
... const { Networks } = require('@1inch/solidity-utils/hardhat-setup'); const net = new Networks(true, 'mainnet', true); net.register(your_network_name, networkId, process.env.YOURNETWORK_RPC_URL, process.env.YOURNETWORK_PRIVATE_KEY, etherscan_network_name, process.env.YOURNETWORK_ETHERSCAN_KEY); const networks = net.networks; const etherscan = net.etherscan; ...
- Skip this step if your network is supported. This can be checked by observing whether the network is mentioned (registered or not) during a test run, visible in the console output. This verification can be done also by reviewing the
-
Set Environment Variables: Define necessary environment variables in the
.env
file located at the project root. Include variables such asYOURNETWORK_RPC_URL
,YOURNETWORK_PRIVATE_KEY
, andYOURNETWORK_ETHERSCAN_KEY
with appropriate values:-
YOURNETWORK_RPC_URL
: The RPC URL for accessing your network's node. This URL can support the HTTP header 'auth-key'. To use this header, append the header value to the URL using the|
symbol. For example:http://localhost:8545|HeaderValue
. This format allows you to authenticate requests to your node. -
YOURNETWORK_PRIVATE_KEY
: Your account's private key, which should be entered without the0x
prefix. This key is used for deploying contracts and executing transactions on the network. -
YOURNETWORK_ETHERSCAN_KEY
: The API key for an Etherscan-like blockchain explorer that supports your network. This key is necessary for verifying and publishing your contract's source code. Ensure you register for an API key with a compatible explorer service for your network.
-
- Deploy Oracles:
- Use the deploy script located at
deploy/commands/simple-deploy.js
. You can find a description of the script and how to use it in the scripts description. - Configure the
PARAMS
object for each protocol you wish to deploy an oracle for. The parameters include:- contractName: Name of the contract from the
contracts/oracles/
directory. - args: Arguments required by the contract (See contract's constructor).
- deploymentName: A name for your deployment, which will be used to create a file in the
deployments/
directory.
- contractName: Name of the contract from the
- Ensure the
skip
flag is set tofalse
to proceed with deployment. - Example command for deployment:
yarn && yarn deploy <your_network_name>
.
- Use the deploy script located at
- Deploy Wrappers:
- Follow similar steps as step 5 to deploy necessary wrappers and
MultiWrapper
. You can find different wrappers in thecontracts/wrappers/
directory. AfterMultiWrapper
is deployed, it will be possible to edit these lists of wrappers.
- Follow similar steps as step 5 to deploy necessary wrappers and
- Deploy OffchainOracle:
- Follow similar steps as step 5 to deploy the
OffchainOracle
. Make sure to include the deployed oracles (from step 5),MultiWrapper
with wrappers (from step 6) and specifying the tokens you wish to use as connectors for price discovery. AfterOffchainOracle
is deployed, it will be possible to edit these lists of oracles and connectors.
- Follow similar steps as step 5 to deploy the
For any questions or further assistance, don't hesitate to reach out (for example via issue). This guide aims to facilitate your oracle deployment process, ensuring a smooth and reliable setup.