code-423n4 / 2022-05-alchemix-findings

5 stars 2 forks source link

Gas Optimizations #28

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

1. Remove or replace unused state variables

Saves a storage slot. If the variable is assigned a non-zero value, saves Gsset (20000 gas). If it's assigned a zero value, saves Gsreset (2900 gas). If the variable remains unassigned, there is no gas savings. If the state variable is overriding an interface's public function, mark the variable as constant or immutable so that it does not use a storage slot, and manually add a getter function

File: contracts-full/adapters/lido/WstETHAdapterV1.sol   #1

29       string public override version = "1.0.0";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/lido/WstETHAdapterV1.sol#L29

File: contracts-full/adapters/rocket/RETHAdapterV1.sol   #2

32       string public override version = "1.0.0";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/rocket/RETHAdapterV1.sol#L32

File: contracts-full/adapters/vesper/VesperAdapterV1.sol   #3

30       string public override version = "1.0.0";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/vesper/VesperAdapterV1.sol#L30

File: contracts-full/adapters/fuse/FuseTokenAdapterV1.sol   #4

29       string public override version = "1.0.0";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/fuse/FuseTokenAdapterV1.sol#L29

2. Multiple address mappings can be combined into a single mapping of an address to a struct, where appropriate

Saves a storage slot for the mapping. Depending on the circumstances and sizes of types, can avoid a Gsset (20000 gas) per mapping combined. Reads and subsequent writes can also be cheaper when a function requires both values and they both fit in the same storage slot

File: contracts-full/AlchemicTokenV2Base.sol   #1

34     mapping(address => bool) public whitelisted;
35  
36     /// @notice A set of addresses which are paused from minting new tokens.
37     mapping(address => bool) public paused;
38  
39     /// @notice The amount that each address is permitted to mint.
40     mapping(address => uint256) public mintCeiling;
41  
42     /// @notice The amount of tokens that each address has already minted.
43     mapping(address => uint256) public totalMinted;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L34-L43

File: contracts-full/TransmuterBuffer.sol   #2

43       mapping(address => address) public transmuter;
44  
45       /// @notice The flowRate for each address.
46       mapping(address => uint256) public flowRate;
47  
48       /// @notice The last update timestamp gor the flowRate for each address.
49       mapping(address => uint256) public lastFlowrateUpdate;
50  
51       /// @notice The amount of flow available per ERC20.
52       mapping(address => uint256) public flowAvailable;
53  
54       /// @notice The yieldTokens of each underlying supported by the Alchemist.
55       mapping(address => address[]) public _yieldTokens;
56  
57       /// @notice The total amount of an underlying token that has been exchanged into the transmuter, and has not been claimed.
58       mapping(address => uint256) public currentExchanged;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L43-L58

File: contracts-full/TransmuterBuffer.sol   #3

67       mapping(address => Weighting) public weightings;
68  
69       /// @dev A mapping of addresses to denote permissioned sources of funds
70       mapping(address => bool) public sources;
71  
72       /// @dev A mapping of addresses to their respective AMOs.
73       mapping(address => address) public amos;
74  
75       /// @dev A mapping of underlying tokens to divert to the AMO.
76       mapping(address => bool) public divertToAmo;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L67-L76

File: contracts-full/AlchemicTokenV1.sol   #4

28     mapping (address => bool) public whiteList;
29    
30     /// @notice A set of addresses which are blacklisted from minting new tokens.
31     mapping (address => bool) public blacklist;
32  
33     /// @notice A set of addresses which are paused from minting new tokens.
34     mapping (address => bool) public paused;
35  
36     /// @notice The amount that each address is permitted to mint.
37     mapping (address => uint256) public ceiling;
38  
39     /// @notice The amount of tokens that each address has already minted.
40     mapping (address => uint256) public hasMinted;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L28-L40

File: contracts-full/AlchemicTokenV2.sol   #5

33     mapping(address => bool) public whitelisted;
34  
35     /// @notice A set of addresses which are paused from minting new tokens.
36     mapping(address => bool) public paused;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L33-L36

File: contracts-full/CrossChainCanonicalBase.sol   #6

20       mapping(address => uint256[2]) public swapFees;
21       mapping(address => bool) public feeExempt;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L20-L21

File: contracts-full/AlchemistV2.sol   #7

66       mapping(address => bool) public override sentinels;
67  
68       /// @inheritdoc IAlchemistV2State
69       mapping(address => bool) public override keepers;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L66-L69

File: contracts-full/AlchemistV2.sol   #8

90       mapping(address => Limiters.LinearGrowthLimiter) private _repayLimiters;
91  
92       // @dev The liquidation limiters for each underlying token.
93       mapping(address => Limiters.LinearGrowthLimiter) private _liquidationLimiters;
94  
95       /// @dev Accounts mapped by the address that owns them.
96       mapping(address => Account) private _accounts;
97  
98       /// @dev Underlying token parameters mapped by token address.
99       mapping(address => UnderlyingTokenParams) private _underlyingTokens;
100  
101       /// @dev Yield token parameters mapped by token address.
102       mapping(address => YieldTokenParams) private _yieldTokens;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L90-L102

3. State variables only set in the constructor should be declared immutable

Avoids a Gsset (20000 gas) in the constructor, and replaces each Gwarmacces (100 gas) with a PUSH32 (3 gas). If getters are still desired, '_' can be added to the variable name and the getter can be added manually

File: contracts-full/StakingPools.sol   #1

82     IERC20Mintable public reward;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L82

File: contracts-full/WETHGateway.sol   #2

20       address public whitelist;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/WETHGateway.sol#L20

File: contracts-full/TransmuterConduit.sol   #3

13       address public token;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L13

File: contracts-full/TransmuterConduit.sol   #4

16       address public sourceTransmuter;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L16

File: contracts-full/TransmuterConduit.sol   #5

19       address public sinkTransmuter;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L19

File: contracts-full/EthAssetManager.sol   #6

157       IWETH9 public weth;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L157

4. Structs can be packed into fewer storage slots

Each slot saved can avoid an extra Gsset (20000 gas) for the first setting of the struct. Subsequent reads as well as writes have smaller gas savings

File: contracts-full/interfaces/external/yearn/IYearnVaultV2.sol   #1

10     struct StrategyParams {
11       uint256 performanceFee;
12       uint256 activation;
13       uint256 debtRatio;
14       uint256 minDebtPerHarvest;
15       uint256 maxDebtPerHarvest;
16       uint256 lastReport;
17       uint256 totalDebt;
18       uint256 totalGain;
19       uint256 totalLoss;
20       bool enforceChangeLimit;
21       uint256 profitLimitRatio;
22       uint256 lossLimitRatio;
23       address customCheck;
24     }

Variable ordering with 12 slots instead of the current 13: uint256(32):performanceFee, uint256(32):activation, uint256(32):debtRatio, uint256(32):minDebtPerHarvest, uint256(32):maxDebtPerHarvest, uint256(32):lastReport, uint256(32):totalDebt, uint256(32):totalGain, uint256(32):totalLoss, uint256(32):profitLimitRatio, uint256(32):lossLimitRatio, address(20):customCheck, bool(1):enforceChangeLimit https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/yearn/IYearnVaultV2.sol#L10-L24

File: contracts-full/interfaces/alchemist/IAlchemistV2State.sol   #2

7       struct UnderlyingTokenParams {
8           // The number of decimals the token has. This value is cached once upon registering the token so it is important
9           // that the decimals of the token are immutable or the system will begin to have computation errors.
10           uint8 decimals;
11           // A coefficient used to normalize the token to a value comparable to the debt token. For example, if the
12           // underlying token is 8 decimals and the debt token is 18 decimals then the conversion factor will be
13           // 10^10. One unit of the underlying token will be comparably equal to one unit of the debt token.
14           uint256 conversionFactor;
15           // A flag to indicate if the token is enabled.
16           bool enabled;
17       }

Variable ordering with 2 slots instead of the current 3: uint256(32):conversionFactor, uint8(1):decimals, bool(1):enabled https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2State.sol#L7-L17

File: contracts-full/interfaces/alchemist/IAlchemistV2State.sol   #3

20       struct YieldTokenParams {
21           // The number of decimals the token has. This value is cached once upon registering the token so it is important
22           // that the decimals of the token are immutable or the system will begin to have computation errors.
23           uint8 decimals;
24           // The associated underlying token that can be redeemed for the yield-token.
25           address underlyingToken;
26           // The adapter used by the system to wrap, unwrap, and lookup the conversion rate of this token into its
27           // underlying token.
28           address adapter;
29           // The maximum percentage loss that is acceptable before disabling certain actions.
30           uint256 maximumLoss;
31           // The maximum value of yield tokens that the system can hold, measured in units of the underlying token.
32           uint256 maximumExpectedValue;
33           // The percent of credit that will be unlocked per block. The representation of this value is a 18  decimal
34           // fixed point integer.
35           uint256 creditUnlockRate;
36           // The current balance of yield tokens which are held by users.
37           uint256 activeBalance;
38           // The current balance of yield tokens which are earmarked to be harvested by the system at a later time.
39           uint256 harvestableBalance;
40           // The total number of shares that have been minted for this token.
41           uint256 totalShares;
42           // The expected value of the tokens measured in underlying tokens. This value controls how much of the token
43           // can be harvested. When users deposit yield tokens, it increases the expected value by how much the tokens
44           // are exchangeable for in the underlying token. When users withdraw yield tokens, it decreases the expected
45           // value by how much the tokens are exchangeable for in the underlying token.
46           uint256 expectedValue;
47           // The current amount of credit which is will be distributed over time to depositors.
48           uint256 pendingCredit;
49           // The amount of the pending credit that has been distributed.
50           uint256 distributedCredit;
51           // The block number which the last credit distribution occurred.
52           uint256 lastDistributionBlock;
53           // The total accrued weight. This is used to calculate how much credit a user has been granted over time. The
54           // representation of this value is a 18 decimal fixed point integer.
55           uint256 accruedWeight;
56           // A flag to indicate if the token is enabled.
57           bool enabled;
58       }

Variable ordering with 13 slots instead of the current 14: uint256(32):maximumLoss, uint256(32):maximumExpectedValue, uint256(32):creditUnlockRate, uint256(32):activeBalance, uint256(32):harvestableBalance, uint256(32):totalShares, uint256(32):expectedValue, uint256(32):pendingCredit, uint256(32):distributedCredit, uint256(32):lastDistributionBlock, uint256(32):accruedWeight, address(20):underlyingToken, uint8(1):decimals, bool(1):enabled, address(20):adapter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2State.sol#L20-L58

5. Using calldata instead of memory for read-only arguments in external functions saves gas

When a function with a memory array is called externally, the abi.decode() step has to use a for-loop to copy each index of the calldata to the memory index. Each iteration of this for-loop costs at least 60 gas (i.e. 60 * <mem_array>.length). Using calldata directly, obliviates the need for such a loop in the contract code and runtime execution. Structs have the same overhead as an array of length one

File: contracts-full/TransmuterBuffer.sol   #1

180           address[] memory tokens,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L180

File: contracts-full/TransmuterBuffer.sol   #2

181           uint256[] memory weights

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L181

File: contracts-full/interfaces/transmuter/ITransmuterBuffer.sol   #3

163     function setWeights(address weightToken, address[] memory tokens, uint256[] memory weights) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/transmuter/ITransmuterBuffer.sol#L163

File: contracts-full/interfaces/transmuter/ITransmuterBuffer.sol   #4

163     function setWeights(address weightToken, address[] memory tokens, uint256[] memory weights) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/transmuter/ITransmuterBuffer.sol#L163

File: contracts-full/interfaces/external/IProxyAdmin.sol   #5

17       bytes memory data

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/IProxyAdmin.sol#L17

File: contracts-full/interfaces/vesper/IVesperPool.sol   #6

15       function multiTransfer(address[] memory _recipients, uint256[] memory _amounts)

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/vesper/IVesperPool.sol#L15

File: contracts-full/interfaces/vesper/IVesperPool.sol   #7

15       function multiTransfer(address[] memory _recipients, uint256[] memory _amounts)

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/vesper/IVesperPool.sol#L15

File: contracts-full/interfaces/ITransmuterBuffer.sol   #8

135       function setWeights(address weightToken, address[] memory tokens, uint256[] memory weights) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ITransmuterBuffer.sol#L135

File: contracts-full/interfaces/ITransmuterBuffer.sol   #9

135       function setWeights(address weightToken, address[] memory tokens, uint256[] memory weights) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ITransmuterBuffer.sol#L135

File: contracts-full/interfaces/IStakingPools.sol   #10

27       function setRewardWeights(uint256[] memory _rewardWeights) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IStakingPools.sol#L27

File: contracts-full/interfaces/alchemist/IAlchemistV2AdminActions.sol   #11

75       function initialize(InitializationParams memory params) external;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2AdminActions.sol#L75

File: contracts-full/AlchemistV2.sol   #12

255       function initialize(InitializationParams memory params) external initializer {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L255

6. State variables should be cached in stack variables rather than re-reading them from storage

The instances below point to the second+ access of a state variable within a function. Caching will replace each Gwarmaccess (100 gas) with a much cheaper stack read. Less obvious fixes/optimizations include having local storage variables of mappings within state variable mappings or mappings within state variable structs, having local storage variables of structs within mappings, having local memory caches of state variable structs, or having local caches of state variable contracts/addresses.

File: contracts-full/AlchemicTokenV2Base.sol   #1

100       emit SetFlashMintFee(flashMintFee);

flashMintFee https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L100

File: contracts-full/TransmuterBuffer.sol   #2

238               TokenUtils.safeApprove(debtToken, alchemist, 0);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L238

File: contracts-full/TransmuterBuffer.sol   #3

245           TokenUtils.safeApprove(debtToken, alchemist, type(uint256).max);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L245

File: contracts-full/TransmuterBuffer.sol   #4

247           emit SetAlchemist(alchemist);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L247

File: contracts-full/TransmuterBuffer.sol   #5

284           TokenUtils.safeApprove(underlyingToken, alchemist, type(uint256).max);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L284

File: contracts-full/TransmuterBuffer.sol   #6

374           address[] memory supportedUnderlyingTokens = IAlchemistV2(alchemist)

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L374

File: contracts-full/TransmuterBuffer.sol   #7

390               IAlchemistV2.YieldTokenParams memory params = IAlchemistV2(alchemist)

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L390

File: contracts-full/TransmuterBuffer.sol   #8

406           IAlchemistV2(alchemist).mint(credit, address(this));

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L406

File: contracts-full/TransmuterBuffer.sol   #9

444           IAlchemistV2.YieldTokenParams memory params = IAlchemistV2(alchemist)

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L444

File: contracts-full/TransmuterBuffer.sol   #10

446           uint256 tokensPerShare = IAlchemistV2(alchemist)

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L446

File: contracts-full/TransmuterBuffer.sol   #11

515           (uint256 availableShares, uint256 lastAccruedWeight) = IAlchemistV2(alchemist).positions(address(this), token);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L515

File: contracts-full/TransmuterBuffer.sol   #12

522               IAlchemistV2(alchemist).withdrawUnderlying(token, wantShares, address(this), minimumAmountOut);

alchemist https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L522

File: contracts-full/TransmuterBuffer.sol   #13

154               return flowAvailable[underlyingToken];

flowAvailable https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L154

File: contracts-full/TransmuterBuffer.sol   #14

539           } else if (initialLocalBalance < flowAvailable[underlyingToken]) {

flowAvailable https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L539

File: contracts-full/TransmuterBuffer.sol   #15

541               want = flowAvailable[underlyingToken] - initialLocalBalance;

flowAvailable https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L541

File: contracts-full/TransmuterBuffer.sol   #16

550           if (localBalance > flowAvailable[underlyingToken]) {

flowAvailable https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L550

File: contracts-full/TransmuterBuffer.sol   #17

551               exchangeDelta = flowAvailable[underlyingToken] - currentExchanged[underlyingToken];

flowAvailable https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L551

File: contracts-full/TransmuterBuffer.sol   #18

173               totalBuffered += _getTotalBuffered(_yieldTokens[underlyingToken][i]);

_yieldTokens https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L173

File: contracts-full/TransmuterBuffer.sol   #19

319                   uint256 exchangeable = flowAvailable[underlyingToken] - currentExchanged[underlyingToken];

currentExchanged https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L319

File: contracts-full/TransmuterBuffer.sol   #20

236                   TokenUtils.safeApprove(registeredUnderlyings[i], alchemist, 0);

registeredUnderlyings https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L236

File: contracts-full/TransmuterBuffer.sol   #21

242           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

registeredUnderlyings https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L242

File: contracts-full/TransmuterBuffer.sol   #22

243               TokenUtils.safeApprove(registeredUnderlyings[i], alchemist, type(uint256).max);

registeredUnderlyings https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L243

File: contracts-full/TransmuterBuffer.sol   #23

382           for (uint256 j = 0; j < registeredUnderlyings.length; j++) {

registeredUnderlyings https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L382

File: contracts-full/TransmuterBuffer.sol   #24

245           TokenUtils.safeApprove(debtToken, alchemist, type(uint256).max);

debtToken https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L245

File: contracts-full/TransmuterBuffer.sol   #25

568           IERC20TokenReceiver(amos[underlyingToken]).onERC20Received(underlyingToken, amount);

amos https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L568

File: contracts-full/StakingPools.sol   #26

133       address _pendingGovernance = pendingGovernance;

pendingGovernance https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L133

File: contracts-full/StakingPools.sol   #27

214       _stake.update(_pool, _ctx);

_ctx https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L214

File: contracts-full/StakingPools.sol   #28

228       _stake.update(_pool, _ctx);

_ctx https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L228

File: contracts-full/StakingPools.sol   #29

243       _stake.update(_pool, _ctx);

_ctx https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L243

File: contracts-full/StakingPools.sol   #30

259       _stake.update(_pool, _ctx);

_ctx https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L259

File: contracts-full/StakingPools.sol   #31

272       _stake.update(_pool, _ctx);

_ctx https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L272

File: contracts-full/StakingPools.sol   #32

188       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

_pools https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L188

File: contracts-full/TransmuterV2.sol   #33

155       uint8 debtTokenDecimals = TokenUtils.expectDecimals(syntheticToken);

syntheticToken https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L155

File: contracts-full/TransmuterV2.sol   #34

156       uint8 underlyingTokenDecimals = TokenUtils.expectDecimals(underlyingToken);

underlyingToken https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L156

File: contracts-full/TransmuterV2.sol   #35

263         totalUnexchanged: totalUnexchanged,

totalUnexchanged https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L263

File: contracts-full/TransmuterV2.sol   #36

263         totalUnexchanged: totalUnexchanged,

totalUnexchanged https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L263

File: contracts-full/TransmuterV2.sol   #37

203       emit Paused(isPaused);

isPaused https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L203

File: contracts-full/gALCX.sol   #38

51           pools.withdraw(poolId, poolBalance);

pools https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L51

File: contracts-full/gALCX.sol   #39

58           pools.deposit(poolId, balance);

pools https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L58

File: contracts-full/gALCX.sol   #40

79               pools.deposit(poolId, balance);

pools https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L79

File: contracts-full/gALCX.sol   #41

51           pools.withdraw(poolId, poolBalance);

poolId https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L51

File: contracts-full/gALCX.sol   #42

58           pools.deposit(poolId, balance);

poolId https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L58

File: contracts-full/gALCX.sol   #43

79               pools.deposit(poolId, balance);

poolId https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L79

File: contracts-full/AlchemicTokenV2.sol   #44

94       emit SetFlashMintFee(flashMintFee);

flashMintFee https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L94

File: contracts-full/ThreePoolAssetManager.sol   #45

258           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L258

File: contracts-full/ThreePoolAssetManager.sol   #46

467           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L467

File: contracts-full/ThreePoolAssetManager.sol   #47

464           admin = pendingAdmin;

pendingAdmin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L464

File: contracts-full/ThreePoolAssetManager.sol   #48

259           emit OperatorUpdated(operator);

operator https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L259

File: contracts-full/ThreePoolAssetManager.sol   #49

260           emit RewardReceiverUpdated(rewardReceiver);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L260

File: contracts-full/ThreePoolAssetManager.sol   #50

633           SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L633

File: contracts-full/ThreePoolAssetManager.sol   #51

1015           SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L1015

File: contracts-full/ThreePoolAssetManager.sol   #52

261           emit TransmuterBufferUpdated(transmuterBuffer);

transmuterBuffer https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L261

File: contracts-full/ThreePoolAssetManager.sol   #53

721           IERC20TokenReceiver(transmuterBuffer).onERC20Received(address(token), amount);

transmuterBuffer https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L721

File: contracts-full/ThreePoolAssetManager.sol   #54

262           emit ThreePoolSlippageUpdated(threePoolSlippage);

threePoolSlippage https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L262

File: contracts-full/ThreePoolAssetManager.sol   #55

263           emit MetaPoolSlippageUpdated(metaPoolSlippage);

metaPoolSlippage https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L263

File: contracts-full/TransmuterConduit.sol   #56

36           IERC20TokenReceiver(sinkTransmuter).onERC20Received(token, amount);

token https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L36

File: contracts-full/TransmuterConduit.sol   #57

36           IERC20TokenReceiver(sinkTransmuter).onERC20Received(token, amount);

sinkTransmuter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L36

File: contracts-full/EthAssetManager.sol   #58

221           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L221

File: contracts-full/EthAssetManager.sol   #59

315           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L315

File: contracts-full/EthAssetManager.sol   #60

312           admin = pendingAdmin;

pendingAdmin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L312

File: contracts-full/EthAssetManager.sol   #61

222           emit OperatorUpdated(operator);

operator https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L222

File: contracts-full/EthAssetManager.sol   #62

223           emit RewardReceiverUpdated(rewardReceiver);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L223

File: contracts-full/EthAssetManager.sol   #63

429           SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L429

File: contracts-full/EthAssetManager.sol   #64

699           SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance);

rewardReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L699

File: contracts-full/EthAssetManager.sol   #65

224           emit TransmuterBufferUpdated(transmuterBuffer);

transmuterBuffer https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L224

File: contracts-full/EthAssetManager.sol   #66

500           IERC20TokenReceiver(transmuterBuffer).onERC20Received(address(weth), amount);

transmuterBuffer https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L500

File: contracts-full/EthAssetManager.sol   #67

217                   _metaPoolAssetCache[i] = weth;

weth https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L217

File: contracts-full/EthAssetManager.sol   #68

496           if (amount > (balance = weth.balanceOf(address(this)))) weth.deposit{value: amount - balance}();

weth https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L496

File: contracts-full/EthAssetManager.sol   #69

498           SafeERC20.safeTransfer(address(weth), transmuterBuffer, amount);

weth https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L498

File: contracts-full/EthAssetManager.sol   #70

500           IERC20TokenReceiver(transmuterBuffer).onERC20Received(address(weth), amount);

weth https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L500

File: contracts-full/EthAssetManager.sol   #71

225           emit MetaPoolSlippageUpdated(metaPoolSlippage);

metaPoolSlippage https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L225

File: contracts-full/EthAssetManager.sol   #72

216               if (_metaPoolAssetCache[i] == IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {

_metaPoolAssetCache https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L216

File: contracts-full/AlchemistV2.sol   #73

272           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L272

File: contracts-full/AlchemistV2.sol   #74

298           emit AdminUpdated(admin);

admin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L298

File: contracts-full/AlchemistV2.sol   #75

291           if (msg.sender != pendingAdmin) {

pendingAdmin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L291

File: contracts-full/AlchemistV2.sol   #76

295           admin = pendingAdmin;

pendingAdmin https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L295

File: contracts-full/AlchemistV2.sol   #77

273           emit TransmuterUpdated(transmuter);

transmuter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L273

File: contracts-full/AlchemistV2.sol   #78

795           IERC20TokenReceiver(transmuter).onERC20Received(underlyingToken, actualAmount);

transmuter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L795

File: contracts-full/AlchemistV2.sol   #79

879           IERC20TokenReceiver(transmuter).onERC20Received(underlyingToken, amountUnderlyingTokens);

transmuter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L879

File: contracts-full/AlchemistV2.sol   #80

945           IERC20TokenReceiver(transmuter).onERC20Received(underlyingToken, distributeAmount);

transmuter https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L945

File: contracts-full/AlchemistV2.sol   #81

274           emit MinimumCollateralizationUpdated(minimumCollateralization);

minimumCollateralization https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L274

File: contracts-full/AlchemistV2.sol   #82

275           emit ProtocolFeeUpdated(protocolFee);

protocolFee https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L275

File: contracts-full/AlchemistV2.sol   #83

276           emit ProtocolFeeReceiverUpdated(protocolFeeReceiver);

protocolFeeReceiver https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L276

File: contracts-full/AlchemistV2.sol   #84

411           _repayLimiters[underlyingToken].configure(maximum, blocks);

_repayLimiters https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L411

File: contracts-full/AlchemistV2.sol   #85

420           _liquidationLimiters[underlyingToken].configure(maximum, blocks);

_liquidationLimiters https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L420

File: contracts-full/AlchemistV2.sol   #86

1464               uint256 shares                 = _accounts[owner].balances[yieldToken];

_accounts https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1464

File: contracts-full/AlchemistV2.sol   #87

1490             _accounts[recipient].depositedTokens.add(yieldToken);

_accounts https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1490

File: contracts-full/AlchemistV2.sol   #88

1493           _accounts[recipient].balances[yieldToken] += shares;

_accounts https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1493

File: contracts-full/AlchemistV2.sol   #89

1528               uint256 lastAccruedWeight    = _accounts[owner].lastAccruedWeights[yieldToken];

_accounts https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1528

File: contracts-full/AlchemistV2.sol   #90

1539               uint256 balance = _accounts[owner].balances[yieldToken];

_accounts https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1539

File: contracts-full/AlchemistV2.sol   #91

900           _accounts[msg.sender].lastAccruedWeights[yieldToken] = _yieldTokens[yieldToken].accruedWeight;

_yieldTokens https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L900

7. The result of external function calls should be cached rather than re-calling the function

The instances below point to the second+ call of the function within a single function

File: contracts-full/StakingPools.sol   #1

188       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

_pools.length() https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L188

File: contracts-full/AlchemistV2.sol   #2

364               underlyingToken:       adapter.underlyingToken(),

adapter.underlyingToken() https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L364

File: contracts-full/AlchemistV2.sol   #3

383           TokenUtils.safeApprove(adapter.underlyingToken(), config.adapter, type(uint256).max);

adapter.underlyingToken() https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L383

8. <x> += <y> costs more gas than <x> = <x> + <y> for state variables

File: contracts-full/TransmuterV2.sol   #1

254         totalBuffered += normaizedAmount;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L254

File: contracts-full/TransmuterV2.sol   #2

343         totalBuffered += state.distributeAmount;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L343

File: contracts-full/gALCX.sol   #3

76               exchangeRate += (balance * exchangeRatePrecision) / totalSupply;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L76

9. internal functions only called once can be inlined to save gas

Not inlining costs 20 to 40 gas because of two extra JUMP instructions and additional stack operations needed for function calls.

File: contracts-full/TransmuterBuffer.sol   #1

438       function _getTotalBuffered(address yieldToken)
439           internal
440           view
441           returns (uint256)

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L438-L441

File: contracts-full/StakingPools.sol   #2

375     function _deposit(uint256 _poolId, uint256 _depositAmount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L375

File: contracts-full/StakingPools.sol   #3

431     function _claimExact(uint256 _poolId, uint256 _claimAmount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L431

File: contracts-full/TransmuterV2.sol   #4

190     function _onlyAdmin() internal view {
191       if (!hasRole(ADMIN, msg.sender)) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L190-L191

File: contracts-full/TransmuterV2.sol   #5

550     function _normalizeDebtTokensToUnderlying(uint256 amount) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L550

File: contracts-full/ThreePoolAssetManager.sol   #6

744       function _getEarnedConvex(uint256 amountCurve) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L744

File: contracts-full/EthAssetManager.sol   #7

542       function _getEarnedConvex(uint256 amountCurve) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L542

File: contracts-full/AlchemistV2.sol   #8

979       function _onlyKeeper() internal view {
980           if (!keepers[msg.sender]) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L979-L980

File: contracts-full/AlchemistV2.sol   #9

1068       function _checkMintingLimit(uint256 amount) internal view {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1068

File: contracts-full/AlchemistV2.sol   #10

1243       function _loss(address yieldToken) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1243

File: contracts-full/AlchemistV2.sol   #11

1258       function _distributeCredit(address yieldToken, uint256 amount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1258

File: contracts-full/AlchemistV2.sol   #12

1309       function _wrap(
1310           address yieldToken,
1311           uint256 amount,
1312           uint256 minimumAmountOut
1313       ) internal returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1309-L1313

File: contracts-full/AlchemistV2.sol   #13

1395       function _approveMint(address owner, address spender, uint256 amount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1395

File: contracts-full/AlchemistV2.sol   #14

1406       function _decreaseMintAllowance(address owner, address spender, uint256 amount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1406

File: contracts-full/AlchemistV2.sol   #15

1417       function _approveWithdraw(address owner, address spender, address yieldToken, uint256 shares) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1417

File: contracts-full/AlchemistV2.sol   #16

1457       function _totalValue(address owner) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1457

File: contracts-full/AlchemistV2.sol   #17

1482       function _issueSharesForAmount(
1483           address recipient,
1484           address yieldToken,
1485           uint256 amount
1486       ) internal returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1482-L1486

File: contracts-full/AlchemistV2.sol   #18

1669       function _convertUnderlyingTokensToShares(address yieldToken, uint256 amount) internal view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1669

10. <array>.length should not be looked up in every loop of a for-loop

The overheads outlined below are PER LOOP, excluding the first loop

Caching the length changes each of these to a DUP<N> (3 gas), and gets rid of the extra DUP<N> needed to store the stack offset

File: contracts-full/TransmuterBuffer.sol   #1

172           for (uint256 i = 0; i < _yieldTokens[underlyingToken].length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L172

File: contracts-full/TransmuterBuffer.sol   #2

186           for (uint256 i = 0; i < tokens.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L186

File: contracts-full/TransmuterBuffer.sol   #3

235               for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L235

File: contracts-full/TransmuterBuffer.sol   #4

242           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L242

File: contracts-full/TransmuterBuffer.sol   #5

272           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L272

File: contracts-full/TransmuterBuffer.sol   #6

382           for (uint256 j = 0; j < registeredUnderlyings.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L382

File: contracts-full/TransmuterBuffer.sol   #7

479           for (uint256 j = 0; j < weighting.tokens.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L479

File: contracts-full/base/Multicall.sol   #8

14           for (uint256 i = 0; i < data.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/Multicall.sol#L14

File: contracts-full/CrossChainCanonicalBase.sol   #9

57           for (uint256 i = 0; i < _bridgeTokens.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L57

File: contracts-full/CrossChainCanonicalBase.sol   #10

141           for (uint i = 0; i < bridgeTokensArray.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L141

File: contracts-full/AlchemistV2.sol   #11

990           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L990

File: contracts-full/AlchemistV2.sol   #12

1282           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1282

File: contracts-full/AlchemistV2.sol   #13

1355           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1355

File: contracts-full/AlchemistV2.sol   #14

1461           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1461

File: contracts-full/AlchemistV2.sol   #15

1524           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1524

11. ++i/i++ should be unchecked{++i}/unchecked{++i} when it is not possible for them to overflow, as is the case when used in for- and while-loops

The unchecked keyword is new in solidity version 0.8.0, so this only applies to that version or higher, which these instances are. This saves 30-40 gas PER LOOP

File: contracts-full/TransmuterBuffer.sol   #1

172           for (uint256 i = 0; i < _yieldTokens[underlyingToken].length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L172

File: contracts-full/TransmuterBuffer.sol   #2

186           for (uint256 i = 0; i < tokens.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L186

File: contracts-full/TransmuterBuffer.sol   #3

235               for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L235

File: contracts-full/TransmuterBuffer.sol   #4

242           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L242

File: contracts-full/TransmuterBuffer.sol   #5

272           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L272

File: contracts-full/TransmuterBuffer.sol   #6

382           for (uint256 j = 0; j < registeredUnderlyings.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L382

File: contracts-full/TransmuterBuffer.sol   #7

387           for (uint256 i = 0; i < numYTokens; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L387

File: contracts-full/TransmuterBuffer.sol   #8

479           for (uint256 j = 0; j < weighting.tokens.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L479

File: contracts-full/StakingPools.sol   #9

188       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L188

File: contracts-full/StakingPools.sol   #10

363       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L363

File: contracts-full/base/Multicall.sol   #11

14           for (uint256 i = 0; i < data.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/Multicall.sol#L14

File: contracts-full/ThreePoolAssetManager.sol   #12

250           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L250

File: contracts-full/ThreePoolAssetManager.sol   #13

254           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L254

File: contracts-full/ThreePoolAssetManager.sol   #14

353           for (uint256 i = 0; i < 256; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L353

File: contracts-full/ThreePoolAssetManager.sol   #15

773           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L773

File: contracts-full/ThreePoolAssetManager.sol   #16

902           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L902

File: contracts-full/CrossChainCanonicalBase.sol   #17

57           for (uint256 i = 0; i < _bridgeTokens.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L57

File: contracts-full/CrossChainCanonicalBase.sol   #18

141           for (uint i = 0; i < bridgeTokensArray.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L141

File: contracts-full/EthAssetManager.sol   #19

214           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L214

File: contracts-full/EthAssetManager.sol   #20

567           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L567

File: contracts-full/AlchemistV2.sol   #21

990           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L990

File: contracts-full/AlchemistV2.sol   #22

1282           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1282

File: contracts-full/AlchemistV2.sol   #23

1355           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1355

File: contracts-full/AlchemistV2.sol   #24

1461           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1461

File: contracts-full/AlchemistV2.sol   #25

1524           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1524

12. require()/revert() strings longer than 32 bytes cost extra gas

File: contracts-full/StakingPools.sol   #1

106       require(_governance != address(0), "StakingPools: governance address cannot be 0x0");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L106

File: contracts-full/StakingPools.sol   #2

124       require(_pendingGovernance != address(0), "StakingPools: pending governance address cannot be 0x0");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L124

File: contracts-full/StakingPools.sol   #3

131       require(msg.sender == pendingGovernance, "StakingPools: only pending governance");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L131

File: contracts-full/StakingPools.sol   #4

160       require(tokenPoolIds[_token] == 0, "StakingPools: token already has a pool");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L160

File: contracts-full/StakingPools.sol   #5

183       require(_rewardWeights.length == _pools.length(), "StakingPools: weights length mismatch");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L183

File: contracts-full/AlchemicTokenV1.sol   #6

51       require(whiteList[msg.sender], "AlTokenV1: Alchemist is not whitelisted");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L51

File: contracts-full/AlchemicTokenV1.sol   #7

81       require(total <= ceiling[msg.sender], "AlUSD: Alchemist's ceiling was breached.");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L81

13. private functions not called by the contract should be removed to save deployment gas

File: contracts-full/ThreePoolAssetManager.sol   #1

1026       function min(uint256 x , uint256 y) private pure returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L1026

File: contracts-full/EthAssetManager.sol   #2

710       function min(uint256 x , uint256 y) private pure returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L710

File: contracts-full/EthAssetManager.sol   #3

720       function abs(uint256 x , uint256 y) private pure returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L720

14. Not using the named return variables when a function returns, wastes deployment gas

File: contracts-full/AutoleverageCurveMetapool.sol   #1

27           return ICurveMetapool(poolAddress).exchange_underlying(
28               i,
29               j,
30               debtTokenBalance,
31               minAmountOut
32           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveMetapool.sol#L27-L32

File: contracts-full/TransmuterBuffer.sol   #2

136           return weightings[weightToken].weights[token];

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L136

File: contracts-full/AutoleverageCurveFactoryethpool.sol   #3

41           return ICurveFactoryethpool(poolAddress).exchange(
42               i,
43               j,
44               debtTokenBalance,
45               minAmountOut
46           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveFactoryethpool.sol#L41-L46

File: contracts-full/TransmuterV2.sol   #4

354         return 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L354

File: contracts-full/TransmuterV2.sol   #5

371       return _getExchangedBalance(owner);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L371

File: contracts-full/TransmuterV2.sol   #6

375       return _normalizeDebtTokensToUnderlying(_getExchangedBalance(owner));

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L375

File: contracts-full/ThreePoolAssetManager.sol   #7

399           return v.minimizedBalance > v.startingBalance
400               ? (v.minimizedBalance - v.startingBalance, true)
401               : (v.startingBalance - v.minimizedBalance, false);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L399-L401

File: contracts-full/ThreePoolAssetManager.sol   #8

399           return v.minimizedBalance > v.startingBalance
400               ? (v.minimizedBalance - v.startingBalance, true)
401               : (v.startingBalance - v.minimizedBalance, false);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L399-L401

File: contracts-full/ThreePoolAssetManager.sol   #9

535           return _mintThreePoolTokens(amounts);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L535

File: contracts-full/ThreePoolAssetManager.sol   #10

548           return _mintThreePoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L548

File: contracts-full/ThreePoolAssetManager.sol   #11

561           return _burnThreePoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L561

File: contracts-full/ThreePoolAssetManager.sol   #12

572           return _mintMetaPoolTokens(amounts);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L572

File: contracts-full/ThreePoolAssetManager.sol   #13

585           return _mintMetaPoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L585

File: contracts-full/ThreePoolAssetManager.sol   #14

598           return _burnMetaPoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L598

File: contracts-full/ThreePoolAssetManager.sol   #15

609           return _depositMetaPoolTokens(amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L609

File: contracts-full/ThreePoolAssetManager.sol   #16

620           return _withdrawMetaPoolTokens(amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L620

File: contracts-full/EthAssetManager.sol   #17

368           return _mintMetaPoolTokens(amounts);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L368

File: contracts-full/EthAssetManager.sol   #18

381           return _mintMetaPoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L381

File: contracts-full/EthAssetManager.sol   #19

394           return _burnMetaPoolTokens(asset, amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L394

File: contracts-full/EthAssetManager.sol   #20

405           return _depositMetaPoolTokens(amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L405

File: contracts-full/EthAssetManager.sol   #21

416           return _withdrawMetaPoolTokens(amount);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L416

File: contracts-full/AlchemistV2.sol   #22

152           return (
153               _calculateUnrealizedDebt(owner),
154               account.depositedTokens.values
155           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L152-L155

File: contracts-full/AlchemistV2.sol   #23

152           return (
153               _calculateUnrealizedDebt(owner),
154               account.depositedTokens.values
155           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L152-L155

File: contracts-full/AlchemistV2.sol   #24

167           return (account.balances[yieldToken], account.lastAccruedWeights[yieldToken]);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L167

File: contracts-full/AlchemistV2.sol   #25

167           return (account.balances[yieldToken], account.lastAccruedWeights[yieldToken]);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L167

File: contracts-full/AlchemistV2.sol   #26

213           return (
214               _mintingLimiter.get(),
215               _mintingLimiter.rate,
216               _mintingLimiter.maximum
217           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L213-L217

File: contracts-full/AlchemistV2.sol   #27

213           return (
214               _mintingLimiter.get(),
215               _mintingLimiter.rate,
216               _mintingLimiter.maximum
217           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L213-L217

File: contracts-full/AlchemistV2.sol   #28

213           return (
214               _mintingLimiter.get(),
215               _mintingLimiter.rate,
216               _mintingLimiter.maximum
217           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L213-L217

File: contracts-full/AlchemistV2.sol   #29

230           return (
231               limiter.get(),
232               limiter.rate,
233               limiter.maximum
234           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L230-L234

File: contracts-full/AlchemistV2.sol   #30

230           return (
231               limiter.get(),
232               limiter.rate,
233               limiter.maximum
234           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L230-L234

File: contracts-full/AlchemistV2.sol   #31

230           return (
231               limiter.get(),
232               limiter.rate,
233               limiter.maximum
234           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L230-L234

File: contracts-full/AlchemistV2.sol   #32

247           return (
248               limiter.get(),
249               limiter.rate,
250               limiter.maximum
251           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L247-L251

File: contracts-full/AlchemistV2.sol   #33

247           return (
248               limiter.get(),
249               limiter.rate,
250               limiter.maximum
251           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L247-L251

File: contracts-full/AlchemistV2.sol   #34

247           return (
248               limiter.get(),
249               limiter.rate,
250               limiter.maximum
251           );

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L247-L251

15. Remove unused local variable

File: contracts-full/TransmuterBuffer.sol   #1

515           (uint256 availableShares, uint256 lastAccruedWeight) = IAlchemistV2(alchemist).positions(address(this), token);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L515

16. Using bools for storage incurs overhead

    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/58f635312aa21f947cae5f8578638a85aa2519f5/contracts/security/ReentrancyGuard.sol#L23-L27 Use uint256(1) and uint256(2) for true/false

File: contracts-full/AlchemicTokenV2Base.sol   #1

34     mapping(address => bool) public whitelisted;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L34

File: contracts-full/AlchemicTokenV2Base.sol   #2

37     mapping(address => bool) public paused;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L37

File: contracts-full/TransmuterBuffer.sol   #3

70       mapping(address => bool) public sources;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L70

File: contracts-full/TransmuterBuffer.sol   #4

76       mapping(address => bool) public divertToAmo;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L76

File: contracts-full/utils/Whitelist.sol   #5

15     bool public override disabled;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/utils/Whitelist.sol#L15

File: contracts-full/AlchemicTokenV1.sol   #6

28     mapping (address => bool) public whiteList;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L28

File: contracts-full/AlchemicTokenV1.sol   #7

31     mapping (address => bool) public blacklist;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L31

File: contracts-full/AlchemicTokenV1.sol   #8

34     mapping (address => bool) public paused;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L34

File: contracts-full/TransmuterV2.sol   #9

130     bool public isPaused;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L130

File: contracts-full/AlchemicTokenV2.sol   #10

33     mapping(address => bool) public whitelisted;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L33

File: contracts-full/AlchemicTokenV2.sol   #11

36     mapping(address => bool) public paused;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L36

File: contracts-full/CrossChainCanonicalBase.sol   #12

21       mapping(address => bool) public feeExempt;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L21

File: contracts-full/CrossChainCanonicalBase.sol   #13

25       mapping(address => bool) public bridgeTokens; // Used for the logic checks

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L25

File: contracts-full/CrossChainCanonicalBase.sol   #14

28       bool public exchangesPaused; // Pause old token exchanges in case of an emergency

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L28

File: contracts-full/CrossChainCanonicalBase.sol   #15

29       mapping(address => bool) public bridgeTokenEnabled;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L29

File: contracts-full/AlchemistV2.sol   #16

66       mapping(address => bool) public override sentinels;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L66

File: contracts-full/AlchemistV2.sol   #17

69       mapping(address => bool) public override keepers;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L69

17. Use a more recent version of solidity

Use a solidity version of at least 0.8.0 to get overflow protection without SafeMath Use a solidity version of at least 0.8.2 to get compiler automatic inlining Use a solidity version of at least 0.8.3 to get better struct packing and cheaper multiple storage reads Use a solidity version of at least 0.8.4 to get custom errors, which are cheaper at deployment than revert()/require() strings Use a solidity version of at least 0.8.10 to have external calls skip contract existence checks if the external call has a return value

File: contracts-full/base/SelfPermit.sol   #1

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/SelfPermit.sol#L2

File: contracts-full/interfaces/IERC20PermitAllowed.sol   #2

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20PermitAllowed.sol#L2

File: contracts-full/interfaces/lido/IWstETH.sol   #3

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/lido/IWstETH.sol#L2

File: contracts-full/interfaces/lido/IStETH.sol   #4

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/lido/IStETH.sol#L2

File: contracts-full/interfaces/IERC20Mintable.sol   #5

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20Mintable.sol#L1

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #6

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L2

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #7

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L2

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #8

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L2

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #9

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L2

File: contracts-full/interfaces/convex/IConvexToken.sol   #10

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/convex/IConvexToken.sol#L2

File: contracts-full/interfaces/convex/IConvexBooster.sol   #11

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/convex/IConvexBooster.sol#L2

File: contracts-full/interfaces/convex/IConvexRewards.sol   #12

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/convex/IConvexRewards.sol#L2

File: contracts-full/interfaces/IERC3156FlashLender.sol   #13

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC3156FlashLender.sol#L2

File: contracts-full/interfaces/IWETH9.sol   #14

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IWETH9.sol#L1

File: contracts-full/interfaces/IERC20Burnable.sol   #15

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20Burnable.sol#L1

File: contracts-full/interfaces/transmuter/ITransmuterBuffer.sol   #16

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/transmuter/ITransmuterBuffer.sol#L2

File: contracts-full/interfaces/transmuter/ITransmuterV2.sol   #17

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/transmuter/ITransmuterV2.sol#L2

File: contracts-full/interfaces/ISelfPermit.sol   #18

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ISelfPermit.sol#L2

File: contracts-full/interfaces/rocket/IRocketStorage.sol   #19

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/rocket/IRocketStorage.sol#L2

File: contracts-full/interfaces/rocket/IRETH.sol   #20

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/rocket/IRETH.sol#L2

File: contracts-full/interfaces/external/aave/IAToken.sol   #21

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IAToken.sol#L2

File: contracts-full/interfaces/external/aave/IWethGateway.sol   #22

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IWethGateway.sol#L2

File: contracts-full/interfaces/external/aave/IScaledBalanceToken.sol   #23

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IScaledBalanceToken.sol#L2

File: contracts-full/interfaces/external/aave/ILendingPoolAddressesProviderRegistry.sol   #24

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPoolAddressesProviderRegistry.sol#L2

File: contracts-full/interfaces/external/aave/DataTypes.sol   #25

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L2

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #26

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L2

File: contracts-full/interfaces/external/aave/IStaticAToken.sol   #27

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IStaticAToken.sol#L2

File: contracts-full/interfaces/external/aave/ILendingPoolAddressesProvider.sol   #28

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPoolAddressesProvider.sol#L2

File: contracts-full/interfaces/external/maker/IDssProxyActions.sol   #29

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/maker/IDssProxyActions.sol#L2

File: contracts-full/interfaces/external/uniswap/ISwapRouter.sol   #30

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/uniswap/ISwapRouter.sol#L2

File: contracts-full/interfaces/external/IWETH9.sol   #31

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/IWETH9.sol#L1

File: contracts-full/interfaces/external/tether/ITetherToken.sol   #32

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/tether/ITetherToken.sol#L1

File: contracts-full/interfaces/external/yearn/IYearnVaultV2.sol   #33

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/yearn/IYearnVaultV2.sol#L2

File: contracts-full/interfaces/ITransmuterV1.sol   #34

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ITransmuterV1.sol#L2

File: contracts-full/interfaces/IAlchemistV2.sol   #35

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAlchemistV2.sol#L1

File: contracts-full/interfaces/vesper/IVesperRewards.sol   #36

4   pragma solidity >=0.6.12;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/vesper/IVesperRewards.sol#L4

File: contracts-full/interfaces/vesper/IVesperPool.sol   #37

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/vesper/IVesperPool.sol#L2

File: contracts-full/interfaces/ITokenAdapter.sol   #38

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ITokenAdapter.sol#L1

File: contracts-full/interfaces/IWETHGateway.sol   #39

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IWETHGateway.sol#L1

File: contracts-full/interfaces/ITransmuterBuffer.sol   #40

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ITransmuterBuffer.sol#L2

File: contracts-full/interfaces/IERC20Minimal.sol   #41

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20Minimal.sol#L1

File: contracts-full/interfaces/IMulticall.sol   #42

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IMulticall.sol#L2

File: contracts-full/interfaces/IERC20TokenReceiver.sol   #43

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20TokenReceiver.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2Actions.sol   #44

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2Actions.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2Events.sol   #45

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2Events.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2State.sol   #46

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2State.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2AdminActions.sol   #47

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2AdminActions.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2Errors.sol   #48

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2Errors.sol#L1

File: contracts-full/interfaces/alchemist/IAlchemistV2Immutables.sol   #49

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2Immutables.sol#L1

File: contracts-full/interfaces/IERC20Metadata.sol   #50

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20Metadata.sol#L1

File: contracts-full/interfaces/IERC3156FlashBorrower.sol   #51

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC3156FlashBorrower.sol#L2

File: contracts-full/interfaces/IAlchemicToken.sol   #52

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAlchemicToken.sol#L2

File: contracts-full/libraries/LiquidityMath.sol   #53

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/LiquidityMath.sol#L2

File: contracts-full/libraries/SafeCast.sol   #54

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/SafeCast.sol#L2

File: contracts-full/libraries/RocketPool.sol   #55

1   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/RocketPool.sol#L1

File: contracts-full/libraries/Tick.sol   #56

2   pragma solidity >=0.5.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/Tick.sol#L2

18. Use a more recent version of solidity

Use a solidity version of at least 0.8.10 to have external calls skip contract existence checks if the external call has a return value

File: contracts-full/libraries/SafeERC20.sol   #1

2   pragma solidity >=0.8.4;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/SafeERC20.sol#L2

19. Use a more recent version of solidity

Use a solidity version of at least 0.8.2 to get compiler automatic inlining Use a solidity version of at least 0.8.3 to get better struct packing and cheaper multiple storage reads Use a solidity version of at least 0.8.4 to get custom errors, which are cheaper at deployment than revert()/require() strings Use a solidity version of at least 0.8.10 to have external calls skip contract existence checks if the external call has a return value

File: contracts-full/interfaces/external/IProxyAdmin.sol   #1

3   pragma solidity ^0.8.0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/IProxyAdmin.sol#L3

20. It costs more gas to initialize variables to zero than to let the default of zero be applied

File: contracts-full/TransmuterBuffer.sol   #1

172           for (uint256 i = 0; i < _yieldTokens[underlyingToken].length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L172

File: contracts-full/TransmuterBuffer.sol   #2

186           for (uint256 i = 0; i < tokens.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L186

File: contracts-full/TransmuterBuffer.sol   #3

235               for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L235

File: contracts-full/TransmuterBuffer.sol   #4

242           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L242

File: contracts-full/TransmuterBuffer.sol   #5

272           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L272

File: contracts-full/TransmuterBuffer.sol   #6

382           for (uint256 j = 0; j < registeredUnderlyings.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L382

File: contracts-full/TransmuterBuffer.sol   #7

387           for (uint256 i = 0; i < numYTokens; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L387

File: contracts-full/TransmuterBuffer.sol   #8

479           for (uint256 j = 0; j < weighting.tokens.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L479

File: contracts-full/TransmuterBuffer.sol   #9

534           uint256 want = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L534

File: contracts-full/TransmuterBuffer.sol   #10

549           uint256 exchangeDelta = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L549

File: contracts-full/StakingPools.sol   #11

188       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L188

File: contracts-full/StakingPools.sol   #12

363       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L363

File: contracts-full/base/Multicall.sol   #13

14           for (uint256 i = 0; i < data.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/Multicall.sol#L14

File: contracts-full/TransmuterV2.sol   #14

96     address public constant ZERO_ADDRESS = address(0);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L96

File: contracts-full/ThreePoolAssetManager.sol   #15

250           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L250

File: contracts-full/ThreePoolAssetManager.sol   #16

254           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L254

File: contracts-full/ThreePoolAssetManager.sol   #17

353           for (uint256 i = 0; i < 256; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L353

File: contracts-full/ThreePoolAssetManager.sol   #18

771           uint256 normalizedTotal   = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L771

File: contracts-full/ThreePoolAssetManager.sol   #19

773           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L773

File: contracts-full/ThreePoolAssetManager.sol   #20

901           uint256 total = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L901

File: contracts-full/ThreePoolAssetManager.sol   #21

902           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L902

File: contracts-full/CrossChainCanonicalBase.sol   #22

57           for (uint256 i = 0; i < _bridgeTokens.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L57

File: contracts-full/CrossChainCanonicalBase.sol   #23

141           for (uint i = 0; i < bridgeTokensArray.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L141

File: contracts-full/EthAssetManager.sol   #24

214           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L214

File: contracts-full/EthAssetManager.sol   #25

566           uint256 total = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L566

File: contracts-full/EthAssetManager.sol   #26

567           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L567

File: contracts-full/AlchemistV2.sol   #27

990           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L990

File: contracts-full/AlchemistV2.sol   #28

1282           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1282

File: contracts-full/AlchemistV2.sol   #29

1355           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1355

File: contracts-full/AlchemistV2.sol   #30

1458           uint256 totalValue = 0;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1458

File: contracts-full/AlchemistV2.sol   #31

1461           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1461

File: contracts-full/AlchemistV2.sol   #32

1524           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1524

21. internal functions not called by the contract should be removed to save deployment gas

If the functions are required by an interface, the contract should inherit from that interface and use the override keyword

File: contracts-full/TransmuterBuffer.sol   #1

490       function _alchemistDonate(address token, uint256 amount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L490

File: contracts-full/TransmuterBuffer.sol   #2

498       function _alchemistDeposit(address token, uint256 amount) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L498

File: contracts-full/TransmuterBuffer.sol   #3

511       function _alchemistWithdraw(address token, uint256 amountUnderlying) internal {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L511

File: contracts-full/ThreePoolAssetManager.sol   #4

1008       function _claimRewards() internal returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L1008

File: contracts-full/EthAssetManager.sol   #5

692       function _claimRewards() internal returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L692

File: contracts-full/AlchemistV2.sol   #6

1740       function _uadd(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x + y; }

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1740

File: contracts-full/AlchemistV2.sol   #7

1750       function _usub(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x - y; }

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1750

22. ++i costs less gas than ++i, especially when it's used in for-loops (--i/i-- too)

Saves 6 gas PER LOOP

File: contracts-full/TransmuterBuffer.sol   #1

172           for (uint256 i = 0; i < _yieldTokens[underlyingToken].length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L172

File: contracts-full/TransmuterBuffer.sol   #2

186           for (uint256 i = 0; i < tokens.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L186

File: contracts-full/TransmuterBuffer.sol   #3

235               for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L235

File: contracts-full/TransmuterBuffer.sol   #4

242           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L242

File: contracts-full/TransmuterBuffer.sol   #5

272           for (uint256 i = 0; i < registeredUnderlyings.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L272

File: contracts-full/TransmuterBuffer.sol   #6

382           for (uint256 j = 0; j < registeredUnderlyings.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L382

File: contracts-full/TransmuterBuffer.sol   #7

387           for (uint256 i = 0; i < numYTokens; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L387

File: contracts-full/TransmuterBuffer.sol   #8

479           for (uint256 j = 0; j < weighting.tokens.length; j++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L479

File: contracts-full/StakingPools.sol   #9

188       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L188

File: contracts-full/StakingPools.sol   #10

363       for (uint256 _poolId = 0; _poolId < _pools.length(); _poolId++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L363

File: contracts-full/base/Multicall.sol   #11

14           for (uint256 i = 0; i < data.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/Multicall.sol#L14

File: contracts-full/ThreePoolAssetManager.sol   #12

250           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L250

File: contracts-full/ThreePoolAssetManager.sol   #13

254           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L254

File: contracts-full/ThreePoolAssetManager.sol   #14

353           for (uint256 i = 0; i < 256; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L353

File: contracts-full/ThreePoolAssetManager.sol   #15

773           for (uint256 i = 0; i < NUM_STABLE_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L773

File: contracts-full/ThreePoolAssetManager.sol   #16

902           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L902

File: contracts-full/CrossChainCanonicalBase.sol   #17

57           for (uint256 i = 0; i < _bridgeTokens.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L57

File: contracts-full/CrossChainCanonicalBase.sol   #18

141           for (uint i = 0; i < bridgeTokensArray.length; i++){

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L141

File: contracts-full/EthAssetManager.sol   #19

214           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L214

File: contracts-full/EthAssetManager.sol   #20

567           for (uint256 i = 0; i < NUM_META_COINS; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L567

File: contracts-full/AlchemistV2.sol   #21

990           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L990

File: contracts-full/AlchemistV2.sol   #22

1282           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1282

File: contracts-full/AlchemistV2.sol   #23

1355           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1355

File: contracts-full/AlchemistV2.sol   #24

1461           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1461

File: contracts-full/AlchemistV2.sol   #25

1524           for (uint256 i = 0; i < depositedTokens.values.length; i++) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L1524

23. Usage of uints/ints smaller than 32 bytes (256 bits) incurs overhead

When using elements that are smaller than 32 bytes, your contract’s gas usage may be higher. This is because the EVM operates on 32 bytes at a time. Therefore, if the element is smaller than that, the EVM must use more operations in order to reduce the size of the element from 32 bytes to the desired size.

https://docs.soliditylang.org/en/v0.8.11/internals/layout_in_storage.html Use a larger size then downcast where needed

File: contracts-full/AutoleverageCurveMetapool.sol   #1

23       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal override returns (uint256 amountOut) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveMetapool.sol#L23

File: contracts-full/AutoleverageCurveMetapool.sol   #2

23       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal override returns (uint256 amountOut) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveMetapool.sol#L23

File: contracts-full/TransmuterBuffer.sol   #3

512           uint8 decimals = TokenUtils.expectDecimals(token);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L512

File: contracts-full/AutoleverageCurveFactoryethpool.sol   #4

37       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal override returns (uint256 amountOut) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveFactoryethpool.sol#L37

File: contracts-full/AutoleverageCurveFactoryethpool.sol   #5

37       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal override returns (uint256 amountOut) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveFactoryethpool.sol#L37

File: contracts-full/base/SelfPermit.sol   #6

22           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/SelfPermit.sol#L22

File: contracts-full/base/SelfPermit.sol   #7

34           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/SelfPermit.sol#L34

File: contracts-full/base/SelfPermit.sol   #8

46           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/SelfPermit.sol#L46

File: contracts-full/base/SelfPermit.sol   #9

58           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/base/SelfPermit.sol#L58

File: contracts-full/TransmuterV2.sol   #10

155       uint8 debtTokenDecimals = TokenUtils.expectDecimals(syntheticToken);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L155

File: contracts-full/TransmuterV2.sol   #11

156       uint8 underlyingTokenDecimals = TokenUtils.expectDecimals(underlyingToken);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L156

File: contracts-full/interfaces/IERC20PermitAllowed.sol   #12

27           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20PermitAllowed.sol#L27

File: contracts-full/interfaces/ICurveFactoryethpool.sol   #13

11       function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external payable returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ICurveFactoryethpool.sol#L11

File: contracts-full/interfaces/ICurveFactoryethpool.sol   #14

11       function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external payable returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ICurveFactoryethpool.sol#L11

File: contracts-full/interfaces/ICurveMetapool.sol   #15

11       function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ICurveMetapool.sol#L11

File: contracts-full/interfaces/ICurveMetapool.sol   #16

11       function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ICurveMetapool.sol#L11

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #17

20       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L20

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #18

20       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L20

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #19

22       function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L22

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #20

22       function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L22

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #21

25           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L25

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #22

26           int128 j,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L26

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #23

38       function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L38

File: contracts-full/interfaces/curve/IStableSwap2Pool.sol   #24

42           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap2Pool.sol#L42

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #25

28       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L28

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #26

28       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L28

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #27

30       function get_dy_underlying(int128 i, int128 j, uint256 dx, uint256[N_COINS] calldata balances) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L30

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #28

30       function get_dy_underlying(int128 i, int128 j, uint256 dx, uint256[N_COINS] calldata balances) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L30

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #29

32       function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L32

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #30

32       function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L32

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #31

41       function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L41

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #32

45           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L45

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #33

60           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L60

File: contracts-full/interfaces/curve/IStableMetaPool.sol   #34

61           int128 j,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableMetaPool.sol#L61

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #35

27       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L27

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #36

27       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L27

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #37

30           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L30

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #38

31           int128 j,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L31

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #39

37           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L37

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #40

38           int128 j,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L38

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #41

50       function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L50

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #42

54           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L54

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #43

69           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L69

File: contracts-full/interfaces/curve/IEthStableMetaPool.sol   #44

70           int128 j,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IEthStableMetaPool.sol#L70

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #45

22       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L22

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #46

22       function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L22

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #47

24       function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L24

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #48

24       function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256 dy);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L24

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #49

26       function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L26

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #50

26       function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L26

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #51

35       function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L35

File: contracts-full/interfaces/curve/IStableSwap3Pool.sol   #52

39           int128 i,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/curve/IStableSwap3Pool.sol#L39

File: contracts-full/interfaces/IAaveLendingPool.sol   #53

9       uint128 liquidityIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L9

File: contracts-full/interfaces/IAaveLendingPool.sol   #54

11       uint128 variableBorrowIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L11

File: contracts-full/interfaces/IAaveLendingPool.sol   #55

13       uint128 currentLiquidityRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L13

File: contracts-full/interfaces/IAaveLendingPool.sol   #56

15       uint128 currentVariableBorrowRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L15

File: contracts-full/interfaces/IAaveLendingPool.sol   #57

17       uint128 currentStableBorrowRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L17

File: contracts-full/interfaces/IAaveLendingPool.sol   #58

18       uint40 lastUpdateTimestamp;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L18

File: contracts-full/interfaces/IAaveLendingPool.sol   #59

26       uint8 id;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L26

File: contracts-full/interfaces/IAaveLendingPool.sol   #60

63           uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L63

File: contracts-full/interfaces/IAaveLendingPool.sol   #61

83           uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L83

File: contracts-full/interfaces/IAaveLendingPool.sol   #62

90           uint16 referralCode,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IAaveLendingPool.sol#L90

File: contracts-full/interfaces/ISelfPermit.sol   #63

23           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ISelfPermit.sol#L23

File: contracts-full/interfaces/ISelfPermit.sol   #64

45           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ISelfPermit.sol#L45

File: contracts-full/interfaces/ISelfPermit.sol   #65

65           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ISelfPermit.sol#L65

File: contracts-full/interfaces/ISelfPermit.sol   #66

88           uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/ISelfPermit.sol#L88

File: contracts-full/interfaces/external/aave/IWethGateway.sol   #67

8       uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IWethGateway.sol#L8

File: contracts-full/interfaces/external/aave/IWethGateway.sol   #68

28       uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IWethGateway.sol#L28

File: contracts-full/interfaces/external/aave/DataTypes.sol   #69

9     uint128 liquidityIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L9

File: contracts-full/interfaces/external/aave/DataTypes.sol   #70

11     uint128 variableBorrowIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L11

File: contracts-full/interfaces/external/aave/DataTypes.sol   #71

13     uint128 currentLiquidityRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L13

File: contracts-full/interfaces/external/aave/DataTypes.sol   #72

15     uint128 currentVariableBorrowRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L15

File: contracts-full/interfaces/external/aave/DataTypes.sol   #73

17     uint128 currentStableBorrowRate;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L17

File: contracts-full/interfaces/external/aave/DataTypes.sol   #74

18     uint40 lastUpdateTimestamp;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L18

File: contracts-full/interfaces/external/aave/DataTypes.sol   #75

26     uint8 id;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/DataTypes.sol#L26

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #76

21       uint16 indexed referral

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L21

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #77

49       uint16 indexed referral

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L49

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #78

99       uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L99

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #79

168       uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L168

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #80

206       uint16 referralCode,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L206

File: contracts-full/interfaces/external/aave/ILendingPool.sol   #81

296       uint16 referralCode

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/ILendingPool.sol#L296

File: contracts-full/interfaces/external/aave/IStaticAToken.sol   #82

16       uint8 v;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IStaticAToken.sol#L16

File: contracts-full/interfaces/external/aave/IStaticAToken.sol   #83

30       uint16 referralCode,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IStaticAToken.sol#L30

File: contracts-full/interfaces/external/aave/IStaticAToken.sol   #84

51       uint8 v,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IStaticAToken.sol#L51

File: contracts-full/interfaces/external/aave/IStaticAToken.sol   #85

61       uint16 referralCode,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/aave/IStaticAToken.sol#L61

File: contracts-full/interfaces/external/uniswap/ISwapRouter.sol   #86

12       uint24 fee;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/uniswap/ISwapRouter.sol#L12

File: contracts-full/interfaces/external/uniswap/ISwapRouter.sol   #87

17       uint160 sqrtPriceLimitX96;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/uniswap/ISwapRouter.sol#L17

File: contracts-full/interfaces/external/uniswap/ISwapRouter.sol   #88

45       uint24 fee;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/uniswap/ISwapRouter.sol#L45

File: contracts-full/interfaces/external/uniswap/ISwapRouter.sol   #89

50       uint160 sqrtPriceLimitX96;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/external/uniswap/ISwapRouter.sol#L50

File: contracts-full/interfaces/vesper/IVesperPool.sol   #90

26           uint8,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/vesper/IVesperPool.sol#L26

File: contracts-full/interfaces/alchemist/IAlchemistV2State.sol   #91

10           uint8 decimals;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2State.sol#L10

File: contracts-full/interfaces/alchemist/IAlchemistV2State.sol   #92

23           uint8 decimals;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/alchemist/IAlchemistV2State.sol#L23

File: contracts-full/interfaces/IERC20Metadata.sol   #93

19       function decimals() external view returns (uint8);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/interfaces/IERC20Metadata.sol#L19

File: contracts-full/libraries/SafeERC20.sol   #94

29       function expectDecimals(address token) internal view returns (uint8) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/SafeERC20.sol#L29

File: contracts-full/libraries/TokenUtils.sol   #95

26       function expectDecimals(address token) internal view returns (uint8) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/TokenUtils.sol#L26

File: contracts-full/AutoleverageBase.sol   #96

19           int128 poolInputIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L19

File: contracts-full/AutoleverageBase.sol   #97

20           int128 poolOutputIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L20

File: contracts-full/AutoleverageBase.sol   #98

58       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal virtual returns (uint256 amountOut);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L58

File: contracts-full/AutoleverageBase.sol   #99

58       function _curveSwap(address poolAddress, address debtToken, int128 i, int128 j, uint256 minAmountOut) internal virtual returns (uint256 amountOut);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L58

File: contracts-full/AutoleverageBase.sol   #100

77           int128 poolInputIndex,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L77

File: contracts-full/AutoleverageBase.sol   #101

78           int128 poolOutputIndex,

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L78

File: contracts-full/AlchemistV2.sol   #102

321           uint8 tokenDecimals = TokenUtils.expectDecimals(underlyingToken);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L321

File: contracts-full/AlchemistV2.sol   #103

322           uint8 debtTokenDecimals = TokenUtils.expectDecimals(debtToken);

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L322

24. abi.encode() is less efficient than abi.encodePacked()

File: contracts-full/AutoleverageBase.sol   #1

102           bytes memory params = abi.encode(Details({
103               pool: pool,
104               poolInputIndex: poolInputIndex,
105               poolOutputIndex: poolOutputIndex,
106               alchemist: alchemist,
107               yieldToken: yieldToken,
108               recipient: msg.sender,
109               targetDebt: targetDebt
110           }));

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L102-L110

25. Expressions for constant values such as a call to keccak256(), should use immutable rather than constant

See this issue for a detail description of the issue

File: contracts-full/AlchemicTokenV2Base.sol   #1

22     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L22

File: contracts-full/AlchemicTokenV2Base.sol   #2

25     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L25

File: contracts-full/AlchemicTokenV2Base.sol   #3

28     bytes32 public constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L28

File: contracts-full/TransmuterBuffer.sol   #4

31       bytes32 public constant ADMIN = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L31

File: contracts-full/TransmuterBuffer.sol   #5

34       bytes32 public constant KEEPER = keccak256("KEEPER");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L34

File: contracts-full/AlchemicTokenV1.sol   #6

22     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L22

File: contracts-full/AlchemicTokenV1.sol   #7

25     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L25

File: contracts-full/TransmuterV2.sol   #8

99     bytes32 public constant ADMIN = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L99

File: contracts-full/TransmuterV2.sol   #9

102     bytes32 public constant SENTINEL = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L102

File: contracts-full/AlchemicTokenV2.sol   #10

21     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L21

File: contracts-full/AlchemicTokenV2.sol   #11

24     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L24

File: contracts-full/AlchemicTokenV2.sol   #12

27     bytes32 public constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L27

26. Using private rather than public for constants, saves gas

If needed, the value can be read from the verified contract source code. Savings are due to the compiler not having to create non-payable getter functions for deployment calldata, and not adding another entry to the method ID table

File: contracts-full/AlchemicTokenV2Base.sol   #1

22     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L22

File: contracts-full/AlchemicTokenV2Base.sol   #2

25     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L25

File: contracts-full/AlchemicTokenV2Base.sol   #3

28     bytes32 public constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L28

File: contracts-full/AlchemicTokenV2Base.sol   #4

31     uint256 public constant BPS = 10000;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L31

File: contracts-full/TransmuterBuffer.sol   #5

31       bytes32 public constant ADMIN = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L31

File: contracts-full/TransmuterBuffer.sol   #6

34       bytes32 public constant KEEPER = keccak256("KEEPER");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L34

File: contracts-full/AlchemicTokenV1.sol   #7

22     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L22

File: contracts-full/AlchemicTokenV1.sol   #8

25     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L25

File: contracts-full/TransmuterV2.sol   #9

99     bytes32 public constant ADMIN = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L99

File: contracts-full/TransmuterV2.sol   #10

102     bytes32 public constant SENTINEL = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L102

File: contracts-full/adapters/lido/WstETHAdapterV1.sol   #11

36       uint256 public immutable ethPoolIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/lido/WstETHAdapterV1.sol#L36

File: contracts-full/adapters/lido/WstETHAdapterV1.sol   #12

37       uint256 public immutable stEthPoolIndex;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/lido/WstETHAdapterV1.sol#L37

File: contracts-full/gALCX.sol   #13

15       uint public constant exchangeRatePrecision = 1e18;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L15

File: contracts-full/AlchemicTokenV2.sol   #14

21     bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L21

File: contracts-full/AlchemicTokenV2.sol   #15

24     bytes32 public constant SENTINEL_ROLE = keccak256("SENTINEL");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L24

File: contracts-full/AlchemicTokenV2.sol   #16

27     bytes32 public constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L27

File: contracts-full/AlchemicTokenV2.sol   #17

30     uint256 public constant BPS = 10000;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L30

File: contracts-full/ThreePoolAssetManager.sol   #18

211       uint256 public immutable convexPoolId;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L211

File: contracts-full/libraries/Limiters.sol   #19

12       uint256 constant public MAX_COOLDOWN_BLOCKS = 7200;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/Limiters.sol#L12

File: contracts-full/libraries/Limiters.sol   #20

15       uint256 constant public FIXED_POINT_SCALAR = 1e18;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/Limiters.sol#L15

File: contracts-full/libraries/FixedPointMath.sol   #21

9     uint256 public constant DECIMALS = 18;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/FixedPointMath.sol#L9

File: contracts-full/libraries/FixedPointMath.sol   #22

10     uint256 public constant ONE = 10**DECIMALS;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/FixedPointMath.sol#L10

File: contracts-full/WETHGateway.sol   #23

14       string public constant version = "2.1.0";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/WETHGateway.sol#L14

File: contracts-full/EthAssetManager.sol   #24

179       uint256 public immutable convexPoolId;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L179

File: contracts-full/AlchemistV2.sol   #25

46       uint256 public constant BPS = 10000;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L46

File: contracts-full/AlchemistV2.sol   #26

51       uint256 public constant FIXED_POINT_SCALAR = 1e18;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemistV2.sol#L51

27. Don't use SafeMath once the solidity version is 0.8.0 or greater

Version 0.8.0 introduces internal overflow checks, so using SafeMath is redundant and adds overhead

File: contracts-full/TransmuterBuffer.sol   #1

7   import "@openzeppelin/contracts/utils/math/SafeMath.sol";

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L7

28. Duplicated require()/revert() checks should be refactored to a modifier or function

Saves deployment costs

File: contracts-full/gALCX.sol   #1

107           require(success, "Transfer failed");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L107

29. Multiplication/division by two should use bit shifting

<x> * 2 is equivalent to <x> << 1 and <x> / 2 is the same as <x> >> 1. The MUL and DIV opcodes cost 5 gas, whereas SHL and SHR only cost 3 gas

File: contracts-full/ThreePoolAssetManager.sol   #1

355               if ((examineBalance = (v.maximum + v.minimum) / 2) == previousBalance) break;

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L355

30. Empty blocks should be removed or emit something

The code should be refactored such that they no longer exist, or the block should do something useful, such as emitting an event or reverting. If the block is an empty if-statement block to avoid doing subsequent checks in the else-if/else conditions, the else-if/else conditions should be nested under the negation of the if-statement, because they involve different classes of checks, which may lead to the introduction of errors when the code is later modified (if(x){}else if(y){...}else{...} => if(!x){if(y){...}else{...}})

File: contracts-full/AutoleverageCurveMetapool.sol   #1

20       function _maybeConvertCurveOutput(uint256 amountOut) internal override {}

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveMetapool.sol#L20

File: contracts-full/AutoleverageCurveFactoryethpool.sol   #2

17       receive() external payable {}

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageCurveFactoryethpool.sol#L17

File: contracts-full/ThreePoolAssetManager.sol   #3

737       function onERC20Received(address token, uint256 value) external { /* noop */ }

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L737

File: contracts-full/AutoleverageBase.sol   #4

151           try IAlchemistV2(details.alchemist).mintFrom(details.recipient, details.targetDebt, address(this)) {
152  
153           } catch {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AutoleverageBase.sol#L151-L153

File: contracts-full/EthAssetManager.sol   #5

228       receive() external payable { }

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L228

File: contracts-full/EthAssetManager.sol   #6

535       function onERC20Received(address token, uint256 value) external { /* noop */ }

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L535

31. Use custom errors rather than revert()/require() strings to save deployment gas

Custom errors are available from solidity version 0.8.4. The instances below match or exceed that version

File: contracts-full/StakingPools.sol   #1

106       require(_governance != address(0), "StakingPools: governance address cannot be 0x0");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L106

File: contracts-full/StakingPools.sol   #2

114       require(msg.sender == governance, "StakingPools: only governance");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L114

File: contracts-full/StakingPools.sol   #3

124       require(_pendingGovernance != address(0), "StakingPools: pending governance address cannot be 0x0");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L124

File: contracts-full/StakingPools.sol   #4

131       require(msg.sender == pendingGovernance, "StakingPools: only pending governance");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L131

File: contracts-full/StakingPools.sol   #5

160       require(tokenPoolIds[_token] == 0, "StakingPools: token already has a pool");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L160

File: contracts-full/StakingPools.sol   #6

183       require(_rewardWeights.length == _pools.length(), "StakingPools: weights length mismatch");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L183

File: contracts-full/AlchemicTokenV1.sol   #7

51       require(whiteList[msg.sender], "AlTokenV1: Alchemist is not whitelisted");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L51

File: contracts-full/AlchemicTokenV1.sol   #8

57       require(hasRole(ADMIN_ROLE, msg.sender), "AlTokenV1: Only admin");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L57

File: contracts-full/AlchemicTokenV1.sol   #9

63       require(hasRole(SENTINEL_ROLE, msg.sender), "AlTokenV1: Only sentinel");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L63

File: contracts-full/AlchemicTokenV1.sol   #10

77       require(!blacklist[msg.sender], "AlUSD: Alchemist is blacklisted.");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L77

File: contracts-full/AlchemicTokenV1.sol   #11

78       require(!paused[msg.sender], "AlUSD: Currently paused.");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L78

File: contracts-full/AlchemicTokenV1.sol   #12

81       require(total <= ceiling[msg.sender], "AlUSD: Alchemist's ceiling was breached.");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L81

File: contracts-full/gALCX.sol   #13

33           require(msg.sender == owner, "Not owner");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L33

File: contracts-full/gALCX.sol   #14

90           require(success, "Transfer failed");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L90

File: contracts-full/gALCX.sol   #15

107           require(success, "Transfer failed");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L107

File: contracts-full/libraries/LibFuse.sol   #16

38               require(borrowRateMantissa <= 0.0005e16, "RATE_TOO_HIGH");

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/libraries/LibFuse.sol#L38

32. Functions guaranteed to revert when called by normal users can be marked payable

If a function modifier such as onlyOwner is used, the function will revert if a normal user tries to pay the function. Marking the function as payable will lower the gas cost for legitimate callers because the compiler will not include checks for whether a payment was provided. The extra opcodes avoided are CALLVALUE(2),DUP1(3),ISZERO(3),PUSH2(3),JUMPI(10),PUSH1(3),DUP1(3),REVERT(0),JUMPDEST(1),POP(2), which costs an average of about 21 gas per call to the function, in addition to the extra deployment cost

File: contracts-full/AlchemicTokenV2Base.sol   #1

98     function setFlashFee(uint256 newFee) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L98

File: contracts-full/AlchemicTokenV2Base.sol   #2

111     function mint(address recipient, uint256 amount) external onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L111

File: contracts-full/AlchemicTokenV2Base.sol   #3

132     function setWhitelist(address minter, bool state) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L132

File: contracts-full/AlchemicTokenV2Base.sol   #4

141     function setSentinel(address sentinel) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L141

File: contracts-full/AlchemicTokenV2Base.sol   #5

151     function setCeiling(address minter, uint256 maximum) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L151

File: contracts-full/AlchemicTokenV2Base.sol   #6

161     function pauseMinter(address minter, bool state) external onlySentinel {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L161

File: contracts-full/AlchemicTokenV2Base.sol   #7

189     function lowerHasMinted(uint256 amount) external onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L189

File: contracts-full/AlchemicTokenV2Base.sol   #8

196     function setMaxFlashLoan(uint _maxFlashLoanAmount) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2Base.sol#L196

File: contracts-full/TransmuterBuffer.sol   #9

178       function setWeights(
179           address weightToken,
180           address[] memory tokens,
181           uint256[] memory weights
182       ) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L178-L182

File: contracts-full/TransmuterBuffer.sol   #10

212       function setSource(address source, bool flag) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L212

File: contracts-full/TransmuterBuffer.sol   #11

221       function setTransmuter(address underlyingToken, address newTransmuter) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L221

File: contracts-full/TransmuterBuffer.sol   #12

230       function setAlchemist(address _alchemist) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L230

File: contracts-full/TransmuterBuffer.sol   #13

251       function setAmo(address underlyingToken, address amo) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L251

File: contracts-full/TransmuterBuffer.sol   #14

257       function setDivertToAmo(address underlyingToken, bool divert) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L257

File: contracts-full/TransmuterBuffer.sol   #15

263       function registerAsset(
264           address underlyingToken,
265           address _transmuter
266       ) external override onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L263-L266

File: contracts-full/TransmuterBuffer.sol   #16

289       function setFlowRate(address underlyingToken, uint256 _flowRate)
290           external
291           override
292           onlyAdmin

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L289-L292

File: contracts-full/TransmuterBuffer.sol   #17

301       function onERC20Received(address underlyingToken, uint256 amount)
302           external
303           override
304           onlySource

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L301-L304

File: contracts-full/TransmuterBuffer.sol   #18

327       function exchange(address underlyingToken) external override onlyKeeper {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L327

File: contracts-full/TransmuterBuffer.sol   #19

332       function flushToAmo(address underlyingToken, uint256 amount) external override onlyKeeper {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L332

File: contracts-full/TransmuterBuffer.sol   #20

341       function withdraw(
342           address underlyingToken,
343           uint256 amount,
344           address recipient
345       ) external override onlyTransmuter(underlyingToken) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L341-L345

File: contracts-full/TransmuterBuffer.sol   #21

362       function withdrawFromAlchemist(
363           address yieldToken,
364           uint256 shares,
365           uint256 minimumAmountOut
366       ) external override onlyKeeper {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L362-L366

File: contracts-full/TransmuterBuffer.sol   #22

400       function burnCredit() external override onlyKeeper {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L400

File: contracts-full/TransmuterBuffer.sol   #23

412       function depositFunds(address underlyingToken, uint256 amount)
413           external
414           override
415           onlyKeeper

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterBuffer.sol#L412-L415

File: contracts-full/StakingPools.sol   #24

123     function setPendingGovernance(address _pendingGovernance) external onlyGovernance {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L123

File: contracts-full/StakingPools.sol   #25

144     function setRewardRate(uint256 _rewardRate) external onlyGovernance {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L144

File: contracts-full/StakingPools.sol   #26

159     function createPool(IERC20 _token) external onlyGovernance returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L159

File: contracts-full/StakingPools.sol   #27

182     function setRewardWeights(uint256[] calldata _rewardWeights) external onlyGovernance {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/StakingPools.sol#L182

File: contracts-full/AlchemicTokenV1.sol   #28

76     function mint(address recipient, uint256 amount) external onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L76

File: contracts-full/AlchemicTokenV1.sol   #29

92     function setWhitelist(address minter, bool state) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L92

File: contracts-full/AlchemicTokenV1.sol   #30

101     function setSentinel(address sentinel) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L101

File: contracts-full/AlchemicTokenV1.sol   #31

110     function setBlacklist(address minter) external onlySentinel {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L110

File: contracts-full/AlchemicTokenV1.sol   #32

120     function pauseAlchemist(address alchemist, bool state) external onlySentinel {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L120

File: contracts-full/AlchemicTokenV1.sol   #33

131     function setCeiling(address minter, uint256 maximum) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L131

File: contracts-full/AlchemicTokenV1.sol   #34

159     function lowerHasMinted(uint256 amount) public onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L159

File: contracts-full/TransmuterV2.sol   #35

201     function setPause(bool pauseState) external onlySentinelOrAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L201

File: contracts-full/TransmuterV2.sol   #36

250     function exchange(uint256 amount) external override nonReentrant onlyBuffer notPaused {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterV2.sol#L250

File: contracts-full/adapters/lido/WstETHAdapterV1.sol   #37

87       function wrap(
88           uint256 amount,
89           address recipient
90       ) external lock onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/lido/WstETHAdapterV1.sol#L87-L90

File: contracts-full/adapters/lido/WstETHAdapterV1.sol   #38

115       function unwrap(
116           uint256 amount,
117           address recipient
118       ) external lock onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/lido/WstETHAdapterV1.sol#L115-L118

File: contracts-full/adapters/rocket/RETHAdapterV1.sol   #39

64       function wrap(
65           uint256 amount,
66           address recipient
67       ) external onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/rocket/RETHAdapterV1.sol#L64-L67

File: contracts-full/adapters/rocket/RETHAdapterV1.sol   #40

83       function unwrap(
84           uint256 amount,
85           address recipient
86       ) external lock onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/rocket/RETHAdapterV1.sol#L83-L86

File: contracts-full/adapters/vesper/VesperAdapterV1.sol   #41

56       function wrap(
57           uint256 amount,
58           address recipient
59       ) external onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/vesper/VesperAdapterV1.sol#L56-L59

File: contracts-full/adapters/vesper/VesperAdapterV1.sol   #42

80       function unwrap(
81           uint256 amount,
82           address recipient
83       ) external lock onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/vesper/VesperAdapterV1.sol#L80-L83

File: contracts-full/adapters/fuse/FuseTokenAdapterV1.sol   #43

66       function wrap(
67           uint256 amount,
68           address recipient
69       ) external onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/fuse/FuseTokenAdapterV1.sol#L66-L69

File: contracts-full/adapters/fuse/FuseTokenAdapterV1.sol   #44

89       function unwrap(
90           uint256 amount,
91           address recipient
92       ) external lock onlyAlchemist returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/adapters/fuse/FuseTokenAdapterV1.sol#L89-L92

File: contracts-full/gALCX.sol   #45

39       function transferOwnership(address _owner) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L39

File: contracts-full/gALCX.sol   #46

46       function migrateSource(address _pools, uint _poolId) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/gALCX.sol#L46

File: contracts-full/AlchemicTokenV2.sol   #47

92     function setFlashFee(uint256 newFee) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L92

File: contracts-full/AlchemicTokenV2.sol   #48

105     function mint(address recipient, uint256 amount) external onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L105

File: contracts-full/AlchemicTokenV2.sol   #49

119     function setWhitelist(address minter, bool state) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L119

File: contracts-full/AlchemicTokenV2.sol   #50

128     function setSentinel(address sentinel) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L128

File: contracts-full/AlchemicTokenV2.sol   #51

138     function pauseMinter(address minter, bool state) external onlySentinel {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L138

File: contracts-full/AlchemicTokenV2.sol   #52

164     function setMaxFlashLoan(uint _maxFlashLoanAmount) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV2.sol#L164

File: contracts-full/ThreePoolAssetManager.sol   #53

445       function setPendingAdmin(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L445

File: contracts-full/ThreePoolAssetManager.sol   #54

476       function setOperator(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L476

File: contracts-full/ThreePoolAssetManager.sol   #55

484       function setRewardReceiver(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L484

File: contracts-full/ThreePoolAssetManager.sol   #56

492       function setTransmuterBuffer(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L492

File: contracts-full/ThreePoolAssetManager.sol   #57

504       function setThreePoolSlippage(uint256 value) external onlyOperator {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L504

File: contracts-full/ThreePoolAssetManager.sol   #58

519       function setMetaPoolSlippage(uint256 value) external onlyOperator {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L519

File: contracts-full/ThreePoolAssetManager.sol   #59

532       function mintThreePoolTokens(
533           uint256[NUM_STABLE_COINS] calldata amounts
534       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L532-L534

File: contracts-full/ThreePoolAssetManager.sol   #60

544       function mintThreePoolTokens(
545           ThreePoolAsset asset,
546           uint256 amount
547       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L544-L547

File: contracts-full/ThreePoolAssetManager.sol   #61

557       function burnThreePoolTokens(
558           ThreePoolAsset asset,
559           uint256 amount
560       ) external lock onlyOperator returns (uint256 withdrawn) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L557-L560

File: contracts-full/ThreePoolAssetManager.sol   #62

569       function mintMetaPoolTokens(
570           uint256[NUM_META_COINS] calldata amounts
571       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L569-L571

File: contracts-full/ThreePoolAssetManager.sol   #63

581       function mintMetaPoolTokens(
582           MetaPoolAsset asset,
583           uint256 amount
584       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L581-L584

File: contracts-full/ThreePoolAssetManager.sol   #64

594       function burnMetaPoolTokens(
595           MetaPoolAsset asset,
596           uint256 amount
597       ) external lock onlyOperator returns (uint256 withdrawn) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L594-L597

File: contracts-full/ThreePoolAssetManager.sol   #65

606       function depositMetaPoolTokens(
607           uint256 amount
608       ) external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L606-L608

File: contracts-full/ThreePoolAssetManager.sol   #66

617       function withdrawMetaPoolTokens(
618           uint256 amount
619       ) external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L617-L619

File: contracts-full/ThreePoolAssetManager.sol   #67

626       function claimRewards() external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L626

File: contracts-full/ThreePoolAssetManager.sol   #68

647       function flush(
648           uint256[NUM_STABLE_COINS] calldata amounts
649       ) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L647-L649

File: contracts-full/ThreePoolAssetManager.sol   #69

674       function flush(
675           ThreePoolAsset asset,
676           uint256 amount
677       ) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L674-L677

File: contracts-full/ThreePoolAssetManager.sol   #70

702       function recall(
703           ThreePoolAsset asset,
704           uint256 amount
705       ) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L702-L705

File: contracts-full/ThreePoolAssetManager.sol   #71

717       function reclaimThreePoolAsset(ThreePoolAsset asset, uint256 amount) public lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L717

File: contracts-full/ThreePoolAssetManager.sol   #72

730       function sweep(address token, uint256 amount) external lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L730

File: contracts-full/CrossChainCanonicalBase.sol   #73

133       function toggleExchanges() external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L133

File: contracts-full/CrossChainCanonicalBase.sol   #74

139       function addBridgeToken(address bridgeTokenAddress) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L139

File: contracts-full/CrossChainCanonicalBase.sol   #75

156       function toggleBridgeToken(address bridgeTokenAddress, bool enabled) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L156

File: contracts-full/CrossChainCanonicalBase.sol   #76

163       function setSwapFees(address bridgeTokenAddress, uint256 _bridgeToCanonical, uint256 _canonicalToOld) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L163

File: contracts-full/CrossChainCanonicalBase.sol   #77

169       function toggleFeesForAddress(address targetAddress) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L169

File: contracts-full/CrossChainCanonicalBase.sol   #78

173       function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalBase.sol#L173

File: contracts-full/WETHGateway.sol   #79

35       function refreshAllowance(address alchemist) external onlyOwner {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/WETHGateway.sol#L35

File: contracts-full/TransmuterConduit.sol   #80

34       function distribute(address origin, uint256 amount) external onlySource() {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/TransmuterConduit.sol#L34

File: contracts-full/EthAssetManager.sol   #81

293       function setPendingAdmin(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L293

File: contracts-full/EthAssetManager.sol   #82

324       function setOperator(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L324

File: contracts-full/EthAssetManager.sol   #83

332       function setRewardReceiver(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L332

File: contracts-full/EthAssetManager.sol   #84

340       function setTransmuterBuffer(address value) external onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L340

File: contracts-full/EthAssetManager.sol   #85

352       function setMetaPoolSlippage(uint256 value) external onlyOperator {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L352

File: contracts-full/EthAssetManager.sol   #86

365       function mintMetaPoolTokens(
366           uint256[NUM_META_COINS] calldata amounts
367       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L365-L367

File: contracts-full/EthAssetManager.sol   #87

377       function mintMetaPoolTokens(
378           MetaPoolAsset asset,
379           uint256 amount
380       ) external lock onlyOperator returns (uint256 minted) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L377-L380

File: contracts-full/EthAssetManager.sol   #88

390       function burnMetaPoolTokens(
391           MetaPoolAsset asset,
392           uint256 amount
393       ) external lock onlyOperator returns (uint256 withdrawn) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L390-L393

File: contracts-full/EthAssetManager.sol   #89

402       function depositMetaPoolTokens(
403           uint256 amount
404       ) external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L402-L404

File: contracts-full/EthAssetManager.sol   #90

413       function withdrawMetaPoolTokens(
414           uint256 amount
415       ) external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L413-L415

File: contracts-full/EthAssetManager.sol   #91

422       function claimRewards() external lock onlyOperator returns (bool success) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L422

File: contracts-full/EthAssetManager.sol   #92

442       function flush(
443           uint256[NUM_META_COINS] calldata amounts
444       ) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L442-L444

File: contracts-full/EthAssetManager.sol   #93

463       function flush(
464           MetaPoolAsset asset,
465           uint256 amount
466       ) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L463-L466

File: contracts-full/EthAssetManager.sol   #94

484       function recall(uint256 amount) external lock onlyOperator returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L484

File: contracts-full/EthAssetManager.sol   #95

494       function reclaimEth(uint256 amount) public lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L494

File: contracts-full/EthAssetManager.sol   #96

509       function sweepToken(address token, uint256 amount) external lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L509

File: contracts-full/EthAssetManager.sol   #97

519       function sweepEth(
520           uint256 amount
521       ) external lock onlyAdmin returns (bytes memory result) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L519-L521

33. public functions not called by the contract should be declared external instead

Contracts are allowed to override their parents' functions and change the visibility from external to public and can save gas by doing so.

File: contracts-full/CrossChainCanonicalAlchemicTokenV2.sol   #1

8     function initialize(
9         string memory name,
10         string memory symbol,
11         address[] memory _bridgeTokens
12     ) public initializer {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalAlchemicTokenV2.sol#L8-L12

File: contracts-full/AlchemicTokenV1.sol   #2

138     function burn(uint256 amount) public {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L138

File: contracts-full/AlchemicTokenV1.sol   #3

148     function burnFrom(address owner, uint256 amount) public {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L148

File: contracts-full/AlchemicTokenV1.sol   #4

159     function lowerHasMinted(uint256 amount) public onlyWhitelisted {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/AlchemicTokenV1.sol#L159

File: contracts-full/CrossChainCanonicalGALCX.sol   #5

7     function initialize(
8         string memory name,
9         string memory symbol,
10         address[] memory _bridgeTokens
11     ) public initializer {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/CrossChainCanonicalGALCX.sol#L7-L11

File: contracts-full/ThreePoolAssetManager.sol   #6

298       function exchangeRate(ThreePoolAsset asset) public view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L298

File: contracts-full/ThreePoolAssetManager.sol   #7

330       function calculateRebalance(
331           MetaPoolAsset rebalanceAsset,
332           ThreePoolAsset targetExchangeAsset,
333           uint256 targetExchangeRate
334       ) public view returns (uint256 delta, bool add) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L330-L334

File: contracts-full/ThreePoolAssetManager.sol   #8

408       function claimableRewards() public view returns (uint256 amountCurve, uint256 amountConvex) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L408

File: contracts-full/ThreePoolAssetManager.sol   #9

717       function reclaimThreePoolAsset(ThreePoolAsset asset, uint256 amount) public lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/ThreePoolAssetManager.sol#L717

File: contracts-full/EthAssetManager.sol   #10

253       function exchangeRate() public view returns (uint256) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L253

File: contracts-full/EthAssetManager.sol   #11

269       function claimableRewards() public view returns (uint256 amountCurve, uint256 amountConvex) {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L269

File: contracts-full/EthAssetManager.sol   #12

494       function reclaimEth(uint256 amount) public lock onlyAdmin {

https://github.com/code-423n4/2022-05-alchemix/blob/71abbe683dfd5c0686b7e594fb4f78a14b668d8b/contracts-full/EthAssetManager.sol#L494

liveactionllama commented 2 years ago

Warden created this issue as a placeholder, because their submission was too large for the contest form. They then emailed their md file to our team on 05/06/2022. I've updated this issue with their md file content.

0xfoobar commented 2 years ago

Incredibly comprehensive, great work with the explanations and detailed line number links