---
# System prepended metadata

title: Alchemix TransmuterB Review

---

# Alchemix TransmuterB Review

@dougETH

Scope:
TransmuterB
YearnVaultAdapter
YearnVaultAdapterWithInderaction

Note: this was a quick code review that i did on the scoped code and diff from previous transmuter. This is by no means a replacement of a full audit by a firm, just my personal suggestions based on my familiarity of yearn vaults. 


1. Suggestion:

https://github.com/alchemix-finance/Alchemix-Main/blob/b605dce959a83ed63737f482ae943a8b5944794b/contracts/TransmuterB.sol#L637

https://github.com/alchemix-finance/Alchemix-Main/blob/b605dce959a83ed63737f482ae943a8b5944794b/contracts/TransmuterB.sol#L655

Should these calls be open to anyone? 
`_vaultId != _vaults.lastIndex()` in the final OR makes it so anyone can call this on previous vaults unless im missing smth? is that the intended design?

Maybe it should be also permissioned and control by admin/gov for previous vaults too?

2. Suggestion:

https://github.com/alchemix-finance/Alchemix-Main/blob/b605dce959a83ed63737f482ae943a8b5944794b/contracts/TransmuterB.sol#L746

Is harvest meant to be open? or is it done by a specific role?

Should it be a function that is also permissioned to a specific role?


3. Suggestion/Comment;

https://github.com/alchemix-finance/Alchemix-Main/blob/b605dce959a83ed63737f482ae943a8b5944794b/contracts/adapters/YearnVaultAdapter.sol#L72

Here the vault adapter handles the withdraw from vault function with the default maxLoss argument 0.01% BPS 

see here:

https://github.com/yearn/yearn-vaults/blob/6b85c1279450689be2bb04d6dec1d52387f447f3/contracts/Vault.vy#L860

One core goal on yearn is for strategies to be no loss and users to always get back at least their initial investment. We try to be very diligent about the funds and underlying protocols but of course there can always be edge cases or unforeseen issues with underlying strategies and protocols that may require an adjustement on that maxLoss argument to avoid funds potentially getting stuck in an emergency scenario.

A setting that can be ajusted by governance on yearn vault adapter could be an emergency mechanism in this worst case scenario to withdraw accepting a bigger loss % from the default value. onlyGov

Suggest adding Mock testing on a mock vault to check the transmuter behaviour in case the maxLoss becomes a 0.5% or 1% and validate how it behaves in that scenario.

4. Comments:

Im glad to see code for migrating to newer vaults in transmuter, there are plans at some point to migrate current yvDAI vault to a newer version but is something that we would coordinate with the Alchemix teams and other integrators when we see the need for that improvement. Still not on the near plans but great that the design supports it.






