Yieldy contest - s3cunda's results

A protocol for gaining single side yields on various tokens.

General Information

Platform: Code4rena

Start Date: 21/06/2022

Pot Size: $50,000 USDC

Total HM: 31

Participants: 99

Period: 5 days

Judges: moose-code, JasoonS, denhampreen

Total Solo HM: 17

Id: 139

League: ETH

Yieldy

Findings Distribution

Researcher Performance

Rank: 99/99

Findings: 1

Award: $26.57

🌟 Selected for report: 0

🚀 Solo Findings: 0

gas optimization in Yiedly.sol

in these two functions below, since creditAmout&allowance was already checked in previous require statement, so the next-line algo can use unchecked modifier to reduce gas consumption.

function transfer(address _to, uint256 _value) public override returns (bool) { require(_to != address(0), "Invalid address"); uint256 creditAmount = _value * rebasingCreditsPerToken; require(creditAmount <= creditBalances[msg.sender], "Not enough funds");//@s3cunda: gas //use unchecked creditBalances[msg.sender] = creditBalances[msg.sender] - creditAmount; creditBalances[_to] = creditBalances[_to] + creditAmount; emit Transfer(msg.sender, _to, _value); return true; } /** @notice transfer from address to address with amount @param _from address @param _to address @param _value uint @return bool */ function transferFrom( address _from, address _to, uint256 _value ) public override returns (bool) { require(_allowances[_from][msg.sender] >= _value, "Allowance too low");//@s3cunda: gas //use unchecked uint256 newValue = _allowances[_from][msg.sender] - _value; _allowances[_from][msg.sender] = newValue; emit Approval(_from, msg.sender, newValue); uint256 creditAmount = creditsForTokenBalance(_value); creditBalances[_from] = creditBalances[_from] - creditAmount; creditBalances[_to] = creditBalances[_to] + creditAmount; emit Transfer(_from, _to, _value); return true; }
AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter