---
# System prepended metadata

title: Solidity Mid Test
tags: [tests]

---

###### tags: `tests`
# Solidity Mid Test

### Test Description
The purpose of this test is to:
- see how you perform research to solve new tasks
- communicate with me your research findings and QUESTIONS

**Requirements**
- Ask questions
- Report progress after every time you work on it
- Try to finish as many tasks as possible during your time constraint.

contact @sirpy on telegram

### Tasks
1. GoodDolalr protocol is deployed also on the Fuse (fuse.io) blockchain.
write a solidity function "modifier" that allows only the current "Fuse Validators" to execute the functions which the modifier is applied to. Research how to get the current list of validators **on-chain.** so you can use it in your modifier.

2. Write a solidity method that receives a Block Header + blockhash from an evm blockchain of your choice (ethereum, fuse, binance etc..) and verifies that the hash(BlockHeader) == blockhash
A typical block header would look like:
```
BlockHeader {
  parent_hash: bytes32
  timestamp: uint256,
  number: uint256,
  author: address,
  transactions_root: bytes32,
  uncles_hash: bytes32,
  extra_data: bytes,
  state_root: bytes32,
  receipts_root: bytes32,
  log_bloom: bytes,
  gas_used: uint256,
  gas_limit: uint256,
  difficulty: uint256,
  mixHash:bytes32,
  nonce:uint256
}
```

3. Is there a difference in gas efficiency between the two ways to return the person age? if so why?
```
Person persons[];
...

A.
Person memory p = persons[i]
return p.age

B.
return persons[i].age
```

4. write a solidity calcMaxAmount(uint16 maxImpact, address uniswapv2pair)
given a "max price impact percentage in 16bits" and "uniswap v2 pair" the method should calcaulte
what is the max amount that you can swap from pair.token0 to pair.token1 given the max price impact percentage constraint