# Avalanche contracts review
## AvaLido
### Burns
```solidity
// Burn the stAVAX in the UnstakeRequest. If it's a partial claim we need to burn a proportional amount
// of the original stAVAX using the stAVAX and AVAX amounts in the unstake request.
uint256 amountOfStAVAXToBurn = Math.mulDiv(request.stAVAXLocked, amountAVAX, request.amountRequested);
// In the case that a user claims all but one wei of their avax, and then claims 1 wei separately, we
// will incorrectly round down the amount of stAVAX to burn, leading to a left over amount of 1 wei stAVAX
// in the contract, and a request which can never be fully claimed. I don't know why anyone would do this,
// but maybe this will keep our internal accounting more in order.
if (amountOfStAVAXToBurn == 0) {
amountOfStAVAXToBurn = 1;
}
```
[claim function](https://github.com/lidofinance/avalanche-contracts/blob/3c951b32cc177724ac909d7e8c5c7eae26c3dd05/src/AvaLido.sol#L266-L272)
Why this case is handled separately? mulDiv always rounds down so there will always be an unburned stAvax. And it's not always 1 wei, it depends on the price
Example: 3 stavex locked, 10 avex requested (price 0.3)
Claims:
1) claim 3 avex, Math.mulDiv(3, 3, 10) = 0
2) claim 3 avex, Math.mulDiv(3, 3, 10) = 0
3) claim 3 avex, Math.mulDiv(3, 3, 10) = 0
4) claim 1 avex, Math.mulDiv(3, 1, 10) = 0
Total burned: 0
## stAVAX
### Comments
```solidity
/**
* @notice Converts an amount of stAVAX to its equivalent in AVAX.
* @param totalControlled The amount of AVAX controlled by the protocol.
* @param stAvaxAmount The amount of stAVAX to convert.
* @return UnstakeRequest Its amount of equivalent AVAX.
*/
function stAVAXToAVAX(uint256 totalControlled, uint256 stAvaxAmount) public view returns (uint256) {
```
@return UnstakeRequest - copypaste?
[for stAVAXToAVAX](https://github.com/lidofinance/avalanche-contracts/blob/3c951b32cc177724ac909d7e8c5c7eae26c3dd05/src/stAVAX.sol#L19)
[for avaxToStAVAX](https://github.com/lidofinance/avalanche-contracts/blob/3c951b32cc177724ac909d7e8c5c7eae26c3dd05/src/stAVAX.sol#L41)
### Mul div
https://github.com/lidofinance/avalanche-contracts/blob/3c951b32cc177724ac909d7e8c5c7eae26c3dd05/src/AvaLido.sol#L426