Unordered Key Set

close button

Part I

Iterable Mapping

Download quests in Questplay

A crate has the following properties:

  • uint id

  • uint size

  • uint strength

Build a contract that supports the following functions:

  1. Insert crates into the contract

  2. Query for crate information by id.

  3. Get the IDs of all crate (need not be in order of insertion).

Note that the id of crates also do not necessarily have to be in order (e.g. The first crate inserted can have id 1, but the next crate may have id 100).

Your Task

Write the Crates contract in the file contracts/Crates.sol. You will find the functions you need to implement in contracts/interfaces/ICrates.sol.

You can leave the implementation of deleteCrate(uint id) empty for now.

You should only make changes to contracts/Crates.sol.

Run tests in Questplay

The innkeeper wants an organized system to keep track of everything in his storeroom.