We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L103
uint256 mintable = 0;
Proposed change:
uint256 mintable;
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L192
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L178
function getMintableDebug(uint256 lastMintTimestamp) external { require( globalStartTimestamp > 0, "SupplySchedule: minting not started" ); require( lastMintTimestamp > globalStartTimestamp, "SupplySchedule: attempting to mint before start block" ); ... emit log_named_uint("globalStartTimestamp", globalStartTimestamp); emit log_named_uint("epochLength", epochLength); uint256 startingEpoch = (lastMintTimestamp - globalStartTimestamp) epochLength; uint256 endingEpoch = (block.timestamp - globalStartTimestamp) / epochLength; ; uint256 epochStartTime = globalStartTimestamp + i * epochLength; uint256 epochEndTime = globalStartTimestamp + (i + 1) * epochLength; ... }
Proposed changes:
function getMintableDebug(uint256 lastMintTimestamp) external { uint256 memory _globalStartTimestamp = globalStartTimestamp; uint256 memory _epochLength = epochLength; require( _globalStartTimestamp > 0, "SupplySchedule: minting not started" ); require( lastMintTimestamp > _globalStartTimestamp, "SupplySchedule: attempting to mint before start block" ); ... emit log_named_uint("globalStartTimestamp", _globalStartTimestamp); emit log_named_uint("epochLength", _epochLength); uint256 startingEpoch = (lastMintTimestamp - _globalStartTimestamp) / _epochLength; uint256 endingEpoch = (block.timestamp - _globalStartTimestamp) / _epochLength; ; uint256 epochStartTime = _globalStartTimestamp + i * _epochLength; uint256 epochEndTime = _globalStartTimestamp + (i + 1) * _epochLength; ... }
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadelVester.sol#L132
function vest( address recipient, uint256 _amount, uint256 _unlockBegin ) external { require(msg.sender == vault, "StakedCitadelVester: only xCTDL vault"); require(_amount > 0, "StakedCitadelVester: cannot vest 0"); vesting[recipient].lockedAmounts = vesting[recipient].lockedAmounts + _amount; vesting[recipient].unlockBegin = _unlockBegin; vesting[recipient].unlockEnd = _unlockBegin + vestingDuration; emit Vest( recipient, vesting[recipient].lockedAmounts, _unlockBegin, vesting[recipient].unlockEnd ); }
proposed change:
function vest( address recipient, uint256 _amount, uint256 _unlockBegin ) external { require(msg.sender == vault, "StakedCitadelVester: only xCTDL vault"); require(_amount > 0, "StakedCitadelVester: cannot vest 0"); uint _lockedAmounts = vesting[recipient].lockedAmounts; vesting[recipient].lockedAmounts = _lockedAmounts + _amount; vesting[recipient].unlockBegin = _unlockBegin; vesting[recipient].unlockEnd = _unlockBegin + vestingDuration; emit Vest( recipient, _lockedAmounts, _unlockBegin, vesting[recipient].unlockEnd ); }
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L319
function deposit(uint256 _amount, bytes32[] memory proof) external whenNotPaused { _depositWithAuthorization(_amount, proof); }
function deposit(uint256 _amount, bytes32[] calldata proof) external whenNotPaused { _depositWithAuthorization(_amount, proof); }
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L329
function depositAll(bytes32[] memory proof) external whenNotPaused { _depositWithAuthorization(token.balanceOf(msg.sender), proof); }
function depositAll(bytes32[] calldata proof) external whenNotPaused { _depositWithAuthorization(token.balanceOf(msg.sender), proof); }
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L363
function depositFor( address _recipient, uint256 _amount, bytes32[] memory proof ) external whenNotPaused { _depositForWithAuthorization(_recipient, _amount, proof); }
function depositFor( address _recipient, uint256 _amount, bytes32[] calldata proof ) external whenNotPaused { _depositForWithAuthorization(_recipient, _amount, proof); }
The text was updated successfully, but these errors were encountered:
Cityscape issue #196
8e84bcc
No branches or pull requests
Gas Optimazations
Unnecessarily initialized variable
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L103
Proposed change:
uint256 mintable;
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L192
Proposed change:
uint256 mintable;
Minimizing storage reads
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/SupplySchedule.sol#L178
Proposed changes:
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadelVester.sol#L132
proposed change:
Using Calldata instead of memory
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L319
proposed change:
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L329
proposed change:
https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/StakedCitadel.sol#L363
proposed change:
The text was updated successfully, but these errors were encountered: