PoolTogether TwabRewards contest - pmerkleplant's results

A protocol for no loss prize savings on Ethereum

General Information

Platform: Code4rena

Start Date: 09/12/2021

Pot Size: $25,000 USDC

Total HM: 12

Participants: 25

Period: 4 days

Judge: LSDan

Total Solo HM: 4

Id: 64

League: ETH

PoolTogether

Findings Distribution

Researcher Performance

Rank: 14/25

Findings: 2

Award: $528.85

🌟 Selected for report: 1

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: pmerkleplant

Also found by: GiveMeTestEther, WatchPug, defsec, pauliax

Labels

bug
3 (High Risk)
sponsor confirmed

Awards

510.9568 USDC - $510.96

External Links

Handle

pmerkleplant

Vulnerability details

Impact

There exist ERC20 tokens that charge a fee for every transfer.

This kind of token does not work correctly with the TwabRewards contract as the rewards calculation for an user is based on promotion.tokensPerEpoch (see line 320).

However, the actual amount of tokens the contract holds could be less than promotion.tokensPerEpoch * promotion.numberOfEpochs leading to not claimable rewards for users claiming later than others.

To disable fee-on transfer tokens for the contract, add the following code in createPromotion around line 11:

uint256 oldBalance = _token.balanceOf(address(this)); _token.safeTransferFrom(msg.sender, address(this), _tokensPerEpoch * _numberOfEpochs); uint256 newBalance = _token.balanceOf(address(this)); require(oldBalance + _tokenPerEpoch * _numberOfEpochs == newBalance);

#0 - dmvt

2022-01-17T11:46:08Z

This issue results in a direct loss of funds and can happen easily.

3 — High (H): vulns have a risk of 3 and are considered “High” severity when assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).
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