Walkthrough for StarkNet Cairo 101 Exercise 4 – Mappings

StarkNet Cairo 101 Exercise 4 – Mappings

This will be a walkthrough for the above mentioned. Follow through to get your SC101 (starknet-cairo-101) points.

post image

This walkthrough assumes the user have installed the Argent wallet and have some Goerli ETH from the faucet or leftover Goerli ETH from completing the previous 3 exercises.

Link to the Voyager Contract for Exercise 4:

https://goerli.voyager.online/contract/0x77d1f63c1fbaecb1e33a9863621d0433a49eb5812033f8d304f07f7efa799bd

Step 1: Go to WRITE CONTRACT, under 2.ASSIGN USER SLOT and click transact. Wait for the transaction to be mined in your Argent wallet.

post image

Step 2: Go to READ CONTRACT, under 6. USER SLOTS, input your Argent generated Goerli testnet address and click Query. Remember this user slot value as it will be used in the next step.

post image

Step 3: Still at the READ CONTRACT page, under 7. VALUES MAPPED, insert the user slot value from the previous step and click Query. Remember this value as it will be used in the next step.

post image

Step 4: Go to WRITE CONTRACT, under 1. CLAIM POINTS. The expected value is your value from the previous step (Step 3) MINUS 32 (So, if your value from Step 3 is 100, your expected value is 100-32=68). Input that value and click transact. Wait for the transaction to be mined in your Argent wallet and you have completed Exercise 4.

post image

Footnote: The logic is that the devs have made a small tweak so you have to do manual calculation to get the expected value instead of just inputting the value.

post image