Platform: Code4rena
Start Date: 24/03/2023
Pot Size: $49,200 USDC
Total HM: 20
Participants: 246
Period: 6 days
Judge: Picodes
Total Solo HM: 1
Id: 226
League: ETH
Rank: 215/246
Findings: 1
Award: $10.79
đ Selected for report: 0
đ Solo Findings: 0
đ Selected for report: Rolezn
Also found by: 0x3b, 0xGordita, 0xSmartContract, 0xhacksmithh, 0xnev, 0xpanicError, 4lulz, Angry_Mustache_Man, ArbitraryExecution, Aymen0909, Bason, BlueAlder, EvanW, Franfran, HHK, Haipls, IgorZuk, JCN, KrisApostolov, Madalad, MiksuJak, MiniGlome, RaymondFam, ReyAdmirado, Rickard, Sathish9098, Udsen, adriro, alexzoid, anodaram, arialblack14, c3phas, carlitox477, ch0bu, chaduke, codeslide, d3e4, dicethedev, ernestognw, fatherOfBlocks, georgits, hunter_w3b, inmarelibero, lukris02, mahdirostami, maxper, pavankv, pixpi, rotcivegaf, smaul, tank, tnevler, wen, yac
10.7864 USDC - $10.79
Number | Optimization Details | Context |
---|---|---|
[G-01] | FUNCTIONS GUARANTEED TO REVERT WHEN CALLED BY NORMAL USERS CAN BE MARKEDÂ PAYABLE | 14 |
[G-02] | PUBLIC FUNCTIONS NOT CALLED BY THE CONTRACT SHOULD BE DECLARED EXTERNAL INSTEAD | 8 |
[G-03] | SETTING THEÂ CONSTRUCTOR TO PAYABLE | 4 |
[G-04] | NOT USING THE NAMED RETURN VARIABLES WHEN A FUNCTION RETURNS, WASTES DEPLOYMENT GAS | 1 |
[G-05] | CAN MAKE THE VARIABLE OUTSIDE THE LOOP TO SAVE GAS | 2 |
[G-06] | The result of function calls should be cached rather than re-calling the function | 2 |
[G-07] | Duplicated require() checks should be refactored to a modifier or function | 1 |
[G-08] | With assembly, .call (bool success) transfer can be done gas-optimized | 5 |
The onlyOwner modifier makes a function revert if not called by the address registered as the owner
There are 14 instances of this issue.
File: /SafEth/derivatives/WstEth.sol 48 function setMaxSlippage(uint256 _slippage) external onlyOwner { 56 function withdraw(uint256 _amount) external onlyOwner {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol
File: /SafEth/derivatives/SfrxEth.sol 51 function setMaxSlippage(uint256 _slippage) external onlyOwner { 60 function withdraw(uint256 _amount) external onlyOwner {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/SfrxEth.sol
File: /SafEth/SafEth.sol 138 function rebalanceToWeights() external onlyOwner { 165 function adjustWeight( 166 uint256 _derivativeIndex, 167 uint256 _weight 168: ) external onlyOwner { 182 function addDerivative( 183 address _contractAddress, 184 uint256 _weight 185: ) external onlyOwner { 202 function setMaxSlippage( 203 uint _derivativeIndex, 204 uint _slippage 205: ) external onlyOwner { 214 function setMinAmount(uint256 _minAmount) external onlyOwner { 223 function setMaxAmount(uint256 _maxAmount) external onlyOwner { 232 function setPauseStaking(bool _pause) external onlyOwner { 241 function setPauseUnstaking(bool _pause) external onlyOwner {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol
File: /SafEth/derivatives/Reth.sol 58 function setMaxSlippage(uint256 _slippage) external onlyOwner { 107 function withdraw(uint256 amount) external onlyOwner {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol
There are 8 instances of this issue.
File: /SafEth/derivatives/WstEth.sol 41 function name() public pure returns (string memory) { 86 function ethPerDerivative(uint256 _amount) public view returns (uint256) { 93 function balance() public view returns (uint256) {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol
File: /SafEth/derivatives/SfrxEth.sol 44 function name() public pure returns (string memory) { 122 function balance() public view returns (uint256) {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/SfrxEth.sol
File: /SafEth/derivatives/Reth.sol 50 function name() public pure returns (string memory) { 211 function ethPerDerivative(uint256 _amount) public view returns (uint256) { 221 function balance() public view returns (uint256) {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol
There are 4 instances of this issue.
File: /SafEth/derivatives/WstEth.sol 24 constructor() {
File: /derivatives/SfrxEth.sol 27 constructor() {
File: /SafEth/SafEth.sol 38 constructor() {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L38
File: /SafEth/derivatives/Reth.sol 33 constructor() {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol#L33
There are 1 instances of this issue.
File: /SafEth/derivatives/Reth.sol 89 ) private returns (uint256 amountOut) {
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol#L89
There are 2 instances of this issue.
File: /SafEth/SafEth.sol 115 uint256 derivativeAmount = (derivatives[i].balance() * 149 uint256 ethAmount = (ethAmountToRebalance * weights[i]) /
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol
There are 2 instances of this issue.
File: /SafEth/derivatives/Reth.sol 170 if (!poolCanDeposit(msg.value)) { 212 if (poolCanDeposit(_amount))
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol
There are 1 instances of this issue.
File: /SafEth/derivatives/WstEth.sol 66 require(sent, "Failed to send Ether"); 77 require(sent, "Failed to send Ether");
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol
return data (bool success,) has to be stored due to EVM architecture, but in a usage like below, âoutâ and âoutsizeâ values are given (0,0), this storage disappears and gas optimization is provided.
https://twitter.com/pashovkrum/status/1607024043718316032?t=xs30iD6ORWtE2bTTYsCFIQ&s=19
There are 5 instances of this issue.
File: /SafEth/derivatives/SfrxEth.sol -84: (bool sent, ) = address(msg.sender).call{value: address(this).balance}( -85 "" -86 ); + bool sent; + assembly { + sent := call(gas(), address(msg.sender), address(this).balance, 0, 0) + } +
File: /SafEth/SafEth.sol 124 (bool sent, ) = address(msg.sender).call{value: ethAmountToWithdraw}(
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L124
File: /SafEth/derivatives/Reth.sol 110 (bool sent, ) = address(msg.sender).call{value: address(this).balance}(
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/Reth.sol#L110
File: /SafEth/derivatives/WstEth.sol 63 (bool sent, ) = address(msg.sender).call{value: address(this).balance}( 76 (bool sent, ) = WST_ETH.call{value: msg.value}("");
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/derivatives/WstEth.sol
#0 - c4-sponsor
2023-04-07T22:08:54Z
toshiSat marked the issue as sponsor acknowledged
#1 - c4-judge
2023-04-23T15:10:45Z
Picodes marked the issue as grade-c
#2 - c4-judge
2023-04-23T15:10:51Z
Picodes marked the issue as grade-b