In transferErcTokens
, the contract calls:
However, there is no guarantee that msg.sender
has executed approve(address(this), amount)
on the ERC20ToGenerateNftFraccion
token. If not approved, transferFrom
will revert. Although some of the code in TokenDivider
updates an internal balances
mapping, it does not ensure an ERC20 approve
or handle reverts explicitly.
Transaction Reverts: Users may repeatedly run into reverts if they do not first call approve(TokenDivider, amount)
.
User Confusion: The internal balances
might no longer reflect the actual token contract’s allowance or real balance after a revert.
A user calls transferErcTokens
without having given the contract an allowance.
The transaction reverts on the external call transferFrom(msg.sender, to, amount)
.
(While not a “theft” vulnerability, it is a usability/design risk that could break your system if the logic does not match standard ERC20 patterns.)
Either require the user to set approve
before calling transferErcTokens
, or redesign to a “pull” model where the user transfers the tokens into the contract first, and then the contract updates internal balances.
Document carefully (in comments or a UI) that users must approve
the contract before transferring fractions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.