Open sourabhmarathe opened 2 years ago
it's because they do math on the stored value and it returns an overflow error. We should change the default value for deal to 1337 instead of 0x13370000..000, and that should fix it.
Tried looking into this actually. Changing it from bytes32(hex"1337")
to bytes32(uint256(1337))
will get it further in the code but it will still fail on this check. Also tried it against your storage PR where it failed at the same spot. Will continue looking into stdStorage
but thought I'd make you aware.
Not sure if this will help anyone, but to shed some light on this:
While the aToken follows erc20 it's implemented slightly different internally - balances is a mapping of struct, so not uint256, but (uint128,uint128), where first is balance
, second it index
.
To deal someone e.g. x aDAI
there's infinite possibilities to represent this with the struct, by choosing index + balance wisely in relation to the current index.
Probably the most reasonable way would be to:
i
from the attached poolx
down by i as y
and write storage as y,i
Checked the code a bit though, and not sure how reasonable it would be to have such a special case for aTokens :sweat_smile:
Also using this issue to track other tokens this has been reported for:
Component
forge-std
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (4b720c2 2022-07-28T00:04:25.986568Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Intel)
Describe the bug
I have not been able to call
deal
on Aave's aToken (address:0xBcca60bB61934080951369a648Fb03DF4F96263C
). I have shared the stacktrace for thedeal
call below.This happens in a test where the first line of the function is
deal(token, msg.sender, amount);
. The error message is[FAIL. Reason: stdStorage find(StdStorage): Slot(s) not found.]
.In addition, it appears that aTokens are ERC20 compliant (their website states that aTokens support basic EIP20 functions).
Stack trace: