1

I'm writing a smart contract and testing on goerli and I want to deploy the smart contract to both mainnet and the polygon chain.

In a payable function, when I require msg.value to be greater than say 10000000000, does this mean on polygon chain the numerical value stays the same? so 10000000000 Wei in Ether becomes 10000000000 Wei in Matic, which considerably reduce the actual value?

See sample code:

        if (msg.sender != owner()) {
        require(msg.value >= cost * _mintAmount);
    }

here uint256 cost=10000000000 In this example, should I manually covert uint256 cost to a much bigger number before deploying to polygon? Is there a way to avoid the conversion?

1 Answer 1

0

Yes till i know one wei is one wei whatever EVM the contract is deployed.

2
  • Right, you are saying wei is a just unit and the value/price is separate. So i need to convert the numbers to keep the pricing more or less the same on the polygon chain. Commented Jan 19, 2023 at 22:02
  • 1
    Exactly. You can use Chainlink to get how much X wei of Matic is worth on USD. Commented Jan 19, 2023 at 22:54

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.