0
0
Blockchain / Solidityprogramming~10 mins

Transfer and approve flow 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 declare the transfer function signature.

Blockchain / Solidity
function transfer(address [1], uint256 amount) public returns (bool);
Drag options to blanks, or click blank then click option'
Afrom
Bto
Cspender
Downer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'from' instead of 'to' for the recipient address.
2fill in blank
medium

Complete the code to approve a spender to spend tokens.

Blockchain / Solidity
function approve(address [1], uint256 amount) public returns (bool);
Drag options to blanks, or click blank then click option'
Aspender
Bowner
Crecipient
Dto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'owner' instead of 'spender'.
3fill in blank
hard

Fix the error in the transferFrom function parameter name.

Blockchain / Solidity
function transferFrom(address [1], address to, uint256 amount) public returns (bool);
Drag options to blanks, or click blank then click option'
Ato
Bspender
Cowner
Dfrom
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'to' or 'spender' instead of 'from'.
4fill in blank
hard

Fill both blanks to complete the allowance mapping declaration.

Blockchain / Solidity
mapping([1] => mapping([2] => uint256)) private _allowances;
Drag options to blanks, or click blank then click option'
Aaddress
Buint256
Dbool
Attempts:
3 left
💡 Hint
Common Mistakes
Using uint256 or bool as keys instead of address.
5fill in blank
hard

Fill all three blanks to complete the transferFrom function body snippet.

Blockchain / Solidity
require(_allowances[[1]][[2]] >= amount, "Allowance too low");
_allowances[[3]][[2]] -= amount;
Drag options to blanks, or click blank then click option'
Afrom
Bspender
Cto
Downer
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'to' and 'spender' keys.