oceanprotocol / pm

Zenhub needs each issue associated with one repo. This repo is a workaround, to mark issues that span >1 repos.
4 stars 0 forks source link

Base tokens where the actual amount transferred is different from the amount passed to the transfer function #132

Closed LoznianuAnamaria closed 2 years ago

LoznianuAnamaria commented 2 years ago

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…

md0x commented 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