0

I am using polygon testnet to deploy my smart contract and ethers.js to interact with it. I have stored the price required to do a particular transaction in the smart contract as 0.001 ETH but when I try to do this transaction using ethers.js by sending an object containing {value: 0.001}, the value required on metamask is 0.001 MATIC instead of the corresponding value for 0.001 ETH. How do I make this happen?

1
  • You need to use Wrapped Ether token. But it is more complicated. Easier to use the native token which is matic
    – Majd TL
    Commented Mar 27, 2022 at 13:10

1 Answer 1

0

Since the Matic / Eth conversion rate is dynamic you need a price feed to convert it on demand on chain from a verifiable source. Oracles does the job for you chainlink's matic-defi-price-feed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.