0
0
Blockchain / Solidityprogramming~10 mins

Cross-chain bridges in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize a bridge connection to Ethereum network.

Blockchain / Solidity
const bridge = new Bridge({ network: '[1]' });
Drag options to blanks, or click blank then click option'
ASolana
BEthereum
CPolkadot
DBitcoin
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a network other than Ethereum will cause connection failure.
2fill in blank
medium

Complete the code to lock tokens on the source chain before bridging.

Blockchain / Solidity
await bridge.lockTokens('[1]', amount);
Drag options to blanks, or click blank then click option'
AsourceAddress
Brecipient
CtokenAddress
DdestinationAddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using destination or recipient address instead of source address.
3fill in blank
hard

Fix the error in the code to correctly verify the bridge transaction hash.

Blockchain / Solidity
const isValid = await bridge.verifyTransaction('[1]');
Drag options to blanks, or click blank then click option'
AblockNumber
Btransaction
CtxHash
Dreceipt
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the whole transaction object or block number instead of txHash.
4fill in blank
hard

Fill both blanks to create a mapping of token symbols to their bridge contract addresses.

Blockchain / Solidity
const tokenBridgeMap = { '[1]': '[2]' };
Drag options to blanks, or click blank then click option'
AUSDT
B0x123abc456def7890
CDAI
D0xabcdef1234567890
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping keys and values or using wrong token symbols.
5fill in blank
hard

Fill all three blanks to filter tokens with balance greater than zero and map their symbols to balances.

Blockchain / Solidity
const positiveBalances = { [1]: balances[[2]] for [3] in balances if balances[[3]] > 0 };
Drag options to blanks, or click blank then click option'
Atoken
Damount
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently in comprehension.