tip3 icon indicating copy to clipboard operation
tip3 copied to clipboard

Proposal: add checking for minimum value in TokenWallet "transfer" and "transferToWallet" methods

Open mnill opened this issue 3 years ago • 1 comments
trafficstars

https://github.com/broxus/tip3/blob/6503e61880c03fb45741c177c25f4955dca5f0df/contracts/abstract/TokenWalletBase.sol#L64

"transfer" and "transferToWallet" methods don't check the minimum required value to start the transfer.

For correctly finish the transfer user must attach at least: require(msg.value > TokenGas.TARGET_WALLET_BALANCE * 2 + deployWalletValue);

Plus gas for the "transfer" and "acceptTransfer"

This must be explicitly described or checked before starting the transfer because smaller value can lead to the tokens lost.

Example:

  • TokenWallet was without transactions for a while.
  • Some dapp tried to call the transfer with attached amount 0.2 ever and deployWalletValue: 0.1 ever
  • This amount of value is enough for particular transfers, but in our case 0.07 evers will be taken as storage payment
  • Destination wallet will be deployed successfully, but "acceptTransfer" will be aborted with error "Out of gas" and a bounce message will not be created.

Example of token lost by out of gas: https://everscan.io/messages/9ef01bb5a831d1286de67183197a7bb34b3cc2955ed719d9f79ec778b6c304e3

mnill avatar Nov 01 '22 17:11 mnill

https://everscan.io/messages/61ed7d731b6c34d62383429a7f8ca88d00f6333f31fa242fd6c3adb3c3e259e9 👉👈

pyAndr3w avatar Apr 05 '24 08:04 pyAndr3w