I have written a contract to mint NFT in solidity. I intend to deploy it to Polygon eventually. There’s a slight confusion, I have put the price in my contract as 0.1 ether which works fine on Rinkeby. When I deploy the same contract on Mumbai Polygon price value 0.1 is deducted but in matic instead of ether. Now this makes sense because ether essentially represents the default coin of deployed chain. My requirement is to ask users to bridge their ethers to Polygon (just like we do for OpenSea) and then pay using ether. How can I force this check that incoming value is in ether otherwise reject transaction?
Asked
Active
Viewed 961 times
2 Answers
0
If you want to make payment in Ether in polygon, you need to use pegged Ether in polygon chain, which is ERC20 token. Ask user to approve 0.1 pegged ETHER for your contract and make transfer from mg.sender by 0.1 ETHER.
gazoblock
- 336
- 2
- 5
-
I’m using and ERC721 right now for the minting contract. can you send me a link/guide on how to implement the ERC20 token inside my contract? – Usama Danish Jan 21 '22 at 10:27
-
do you mean that I will have to create a custom token using ERC20 and then use that in my ERC721 mint contract? – Usama Danish Jan 21 '22 at 12:33
-
You can use already created pegged ETH token on polygon chain. – gazoblock Jan 25 '22 at 15:36
0
You will need to accept Wrapped Ether. (Wrapped Ether is a version of Ethereum pegged onto Polygon or any other chain)
You will implement this just like accepting any other token on Solidity, see this: deposite and withdraw erc20 token using smart contract
AvocadoChocolate
- 995
- 5
- 14