Yieldy contest - asutorufos'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: 14/99

Findings: 2

Award: $1,238.27

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: unforgiven

Also found by: IllIllI, TrungOre, asutorufos, hake, robee

Labels

bug
2 (Med Risk)
sponsor acknowledged

Awards

1211.7009 USDC - $1,211.70

External Links

Lines of code

https://github.com/code-423n4/2022-06-yieldy/blob/main/src/contracts/Staking.sol#:~:text=function%20transferToke(,%7D

Vulnerability details

Impact

There are ERC20 tokens that may make certain customizations to their ERC20 contracts. One type of these tokens is deflationary tokens that charge a certain fee for every transfer() or transferFrom().

Proof of Concept

https://github.com/code-423n4/2022-06-yieldy/blob/main/src/contracts/Staking.sol#:~:text=Invalid%20address%22)%3B-,uint256%20totalTokeAmount%20%3D%20IERC20Upgradeable(TOKE_TOKEN).balanceOf(,)%3B,-%7D

When IERC20Upgradeable(TOKE_TOKEN) get set to totalTokeAmount it will be different once safetransfer have fees as some types of tokens may charge a certain fee for transfer and transferfrom.

It may be better to get the before balance then safetransferfrom then get the after balance to make sure no fees were added.

Tools Used

Manual Review

#0 - toshiSat

2022-07-28T19:26:36Z

We will not support deflationary tokens. We will document this

#1 - KenzoAgada

2022-08-26T08:59:45Z

In the judging sheet, this is judged as unique but looks like a duplicate of #222 M-17

G-1 - Use != 0 instead of > 0 for Unsigned Integer Comparison When dealing with unsigned integer types, comparisons with != 0 are cheaper then with > 0. Staking.sol L#118 Staking.sol L#410 [Staking.sol L#572]https://github.com/code-423n4/2022-06-yieldy/blob/main/src/contracts/Staking.sol#:~:text=)%20external%20%7B-,require(_amount%20%3E%200%2C%20%22Invalid%20amount%22)%3B,-//%20prevent%20unstaking%20if [Staking.sol L#604]https://github.com/code-423n4/2022-06-yieldy/blob/main/src/contracts/Staking.sol#:~:text=%7B-,require(_amount%20%3E%200%2C%20%22Invalid%20amount%22)%3B,-require( Yieldy.sol L#83 Yieldy.sol L#96

G-2 STATE VARIABLES ONLY SET IN THE CONSTRUCTOR SHOULD BE DECLARED IMMUTABLE Avoids a Gsset (20000 gas)

Migration.sol L#14 Migration.sol L#15 Migration.sol L#16

G-3 VISIBILITY: PUBLIC FUNCTIONS TO EXTERNAL The following functions could be set external to save gas and improve code quality. External call cost is less expensive than of public functions. Yieldy.sol L#138 Yieldy.sol L#147 Yieldy.sol L#160 Yieldy.sol L#172 Yieldy.sol L#182 Yieldy.sol L#227

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