'How to use an Oracle to get a token value on Polygon? (Using web3.js)
I'm currently developing a simple project. After a payment is done, I call a smart contract to mint some coins and send them to a wallet.
All good over there, but I need to know the value in USD of the payment done to know how much coins will I mint.
I'm currently working on the Mumbai Testnet, so my payment coin would be MATIC and the coin to mint would be This coin
I read about "aggregator interface v3" on this link:
Using web3js get coin price on uniswap and sushiswap exchange without using their api
However, I don't know exactly how to use it on my case. The example gets the price for ETH/USD pair on Kovan network, how do I get the address I would need to instanciate the aggregator for both Matic and the other coin? Would it work on Mumbai Testnet and/or Polygon Mainnet?
Of course, all this will be up on Polygon Mainnet so if the uses are different somehow, let me know!
Thanks for your time!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
