Gas is the measure of computation required to execute your transaction, depending on what functions your contract uses the gas used changes. This is analogous to the transaction bytes size in Bitcoin transactions.
The fees you set are how much gwei you are willing to pay for each gas unit, that's why it's
PerGas. It's analogous to the
satoshi/vbytes in Bitcoin transactions.
So for example, let's say my contract has a function that spends 130k gas and I set the
50, then I'll be paying maximum
130000 * 50 = 6500000 gwei = 0.0065 ether.
And you're correct about
maxFeePerGas, but just to make it crystal clear:
maxPriorityFeePerGas is a tip you'll be paying to the miner so that your transaction is processed before others.
maxFeePerGas is the maximum you'll be paying in total as
baseFeePerGas + PriorityFeePerGas, where
baseFeePerGas is calculated by the protocol.
You always pay the
baseFeePerGas, if that's below
maxFeePerGas the rest will be paid to the miner if
maxPriorityFeePerGas is above zero. The paid priority fee can be lower depending on the maximum fee set.
70 = maxFeePerGas
30 = maxPriorityFeePerGas
50 = baseFeePerGas
You'll pay only 20 as priority fee because that's what's left between maximum and base fees.