Challenge - 5 Problems
L2 Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of L2 Deployment Script
What is the output of this simplified deployment script snippet for an L2 network?
Blockchain / Solidity
const deployContract = async () => { const network = 'Optimism'; const gasLimit = 1500000; const contractAddress = '0x123abc'; console.log(`Deploying to ${network} with gas limit ${gasLimit}`); return contractAddress; }; (async () => { const address = await deployContract(); console.log(`Contract deployed at ${address}`); })();
Attempts:
2 left
💡 Hint
Look at the values passed to the console.log statements and the returned contract address.
✗ Incorrect
The function deployContract returns the contract address string, and the logs print the network and gas limit correctly.
🧠 Conceptual
intermediate1:30remaining
Gas Cost Differences in L1 vs L2
Which statement correctly explains why deploying contracts on L2 networks is generally cheaper than on L1?
Attempts:
2 left
💡 Hint
Think about how L2 networks handle transactions differently from L1.
✗ Incorrect
L2 networks use batching and rollups to reduce the amount of data posted on L1, lowering gas costs.
🔧 Debug
advanced2:30remaining
Identify the Error in L2 Deployment Script
What error will this deployment script produce when run on an L2 network?
Blockchain / Solidity
async function deploy() { const provider = new ethers.providers.JsonRpcProvider('https://l2network.rpc'); const wallet = new ethers.Wallet('0xabc123', provider); const factory = new ethers.ContractFactory(abi, bytecode, wallet); const contract = await factory.deploy({ gasPrice: 1000000000 }); await contract.deployed(); console.log('Contract deployed at:', contract.address); } deploy();
Attempts:
2 left
💡 Hint
Check the type of the gasPrice value passed in the deploy options.
✗ Incorrect
The gasPrice option expects a number or BigNumber, but a string was given causing a TypeError.
📝 Syntax
advanced1:30remaining
Correct Syntax for L2 Contract Deployment
Which option shows the correct syntax to deploy a contract on an L2 network using ethers.js with a custom gas limit?
Attempts:
2 left
💡 Hint
Check the correct property name and object syntax for deploy options.
✗ Incorrect
The correct property is 'gasLimit' with capital L inside an object passed to deploy().
🚀 Application
expert3:00remaining
Calculate Total Gas Cost for L2 Deployment
Given a contract deployment on an L2 network with gas limit 1,200,000 and gas price 0.000000002 ETH, what is the total gas cost in ETH?
Attempts:
2 left
💡 Hint
Multiply gas limit by gas price: 1,200,000 * 0.000000002 ETH.
✗ Incorrect
1,200,000 * 0.000000002 = 0.0024 ETH total gas cost.