Closed LoznianuAnamaria closed 2 years ago
Unless we prohibit the usage of base tokens that charge a fee during an onTransfer
hook, I think we should ensure that the amount received from a token is the one we expect.
In my opinion _pullUnderlying
should return the actual amount transferred with a erc20.balanceOf(address(this))
before and after the transfer, and based on this value calculate the amount that should be sent to the msg.sender
https://github.com/oceanprotocol/contracts/blob/b502cee1fa13de305b543eee587c5ae7fbdda7a1/contracts/pools/balancer/BPool.sol#L1092
Base tokens where the actual amount transferred is different from the amount passed to the transfer function (i.e. erc20 that takes a fee on transfer) + Exotic erc20 base tokens, i.e. elastic supply tokens, etc…