Solidity Polygon Smart Contract – What Currency msg.value Represents on Different Blockchains

polygonsmart-contractsolidity

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?

Best Answer

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