The cost of your deployment is based on 5 things, with a 6th affecting the estimated cost of deployment:
The flat fee of 32k gas. The CREATE op code, which is called during contract creation, costs a fixed 32k gas. This is of course on top of the 21k gas of a normal tx. Note: During contract creation from an EOA (non-contract address), the CREATE opcode isn’t explicitly called. The return value of the tx is actually used to create the contract, but the fixed 32k fee is the same.
The amount of bytecode in the compiled contract. More bytecode means more storage, and each byte costs 200 gas. This adds up very quickly. Note that inherited parent contracts are also included in the bytecode.
The TX data. All the bytecode your sending as tx data costs 68 for non-zero bytes and 4 for zero bytes.
The code actually runs before creation of the contract, e.g. the constructor of the contract. If the constructor requires a lot of computation to generate the bytecode, then it’ll be even more expensive.
The gas price. The higher gas price you use, the higher it will cost. See
ethgasstation.info read more