Polygon – How Does Polygon Deal With Eth Values in Smart Contracts

polygontokens

I want to deploy a Smart Contract to Polygon. My contract takes 0.01 eth to pay for some digital goods.

When deploying to Polygon, the native currency of the chain is not Eth anymore, but Matic, so if my smart contract charging 0.01 Eth for my digital goods on the Ethereum chain, and the same smart contract is charging 0.01 Eth in the Polygon Chain, will I get 0.01 Matic or the equivalent of that in the current Ethereum price?

Best Answer

So in Solidity programming the term "Ether" mean 10^18

(For example: 5 ETHER = 5*10^18 = 5000000000000000000)

So regarding the programming side of things, it does not see Ether as the Ethereum coin, but just as a suffix to indicate size.

Regarding actual workings on Polygon, if you deploy your contract on Matic, it will see any native currency coded into the contract as Matic. So if you set the fee as 0.01 ether, and deploy on Matic; then it will actually charge 0.01 MATIC

Related Topic