Omniscia AmpleSense Audit
BalancerTrader Code Style Findings
BalancerTrader Code Style Findings
BTR-01C: Deprecated Representation Style
Type | Severity | Location |
---|---|---|
Code Style | Informational | BalancerTrader.sol:L21 |
Description:
The representation of the maximum uint256
possible should be represented by the purpose-built type
operator (type(uint256).max
) instead of the non-standard uint256(-1)
representation as it has been deprecated and will not compile in future versions.
Example:
21uint256 constant MAX_INT = uint256(-1);
Recommendation:
We advise the AmpleSense to integrate the type
operator as specified. Additionally, we advise the variable to be renamed as it represents the MAX_UINT
rather than the MAX_INT
possible.
Alleviation:
The new representation style is now properly applied in the code.
BTR-02C: Inexistent Variable Visibility Specifiers
Type | Severity | Location |
---|---|---|
Code Style | Informational | BalancerTrader.sol:L21, L30, L31, L32 |
Description:
The linked variables have no visibility specifiers explicitly set.
Example:
21uint256 constant MAX_INT = uint256(-1);22//USDC will be removed from the parameters below, as trading pair will be EEFI/ETH23 IERC20 public constant amplToken = IERC20(0xD46bA6D942050d489DBd938a2C909A5d5039A161);24 address public constant usdcToken = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;25 IWETH9 public constant wethToken = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);26 IERC20 public eefiToken;27 bytes32 public eefiUsdcPoolID;28 29
30 IPoolV1 constant amplUsdc = IPoolV1(0x7860E28ebFB8Ae052Bfe279c07aC5d94c9cD2937);31 IPoolV1 constant amplEth = IPoolV1(0xa751A143f8fe0a108800Bfb915585E4255C2FE80);32 IVault constant vault = IVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);
Recommendation:
We advise them to be set so to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically.
Alleviation:
All variables now contain a correct visibility specifier explicitly defined.
BTR-03C: Variable Mutability Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | BalancerTrader.sol:L26, L27, L37, L38 |
Description:
The linked variables are assigned to only once during the contract's constructor
.
Example:
35constructor(IERC20 _eefiToken, bytes32 _eefiUsdcPoolID) {36 require(address(_eefiToken) != address(0), "BalancerTrader: Invalid eefi token address");37 eefiToken = IERC20(_eefiToken);38 eefiUsdcPoolID = _eefiUsdcPoolID;39 require(amplToken.approve(address(amplUsdc), MAX_INT), 'BalancerTrader: Approval failed');40 require(amplToken.approve(address(amplEth), MAX_INT), 'BalancerTrader: Approval failed');41}
Recommendation:
We advise them to be set as immutable
greatly optimizing their read access gas cost.
Alleviation:
The linked variables were correctly set as immutable
optimizing the codebase.