Skip to content

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

Open
@mnill

Description

@mnill

"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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions