The solidity team is wondering how you are using the transfer
member function for the type address payable
in your contracts.
The context for this question comes from this issue. We were looking
at redesigning the transfer function. The following is a short
summary.
-
transfer
should be able to forward all gas.- Syntax
transfer{gas: max}(_value)
to mean.call{gas: gas(), value: _value}("")
- To denote the current behaviour, potentially use
min
,
stipend
, - Introduce globals such as
gas.stipend
,gas.left
, or
tx.gax.left
etc instead ofmax
ormin
.
- Syntax
- Deprecate
transfer
and replace it using library or free functions. - Potentially rename
transfer
and forward all gas.
Here are some questions that we would like to be answered:
- Do you need to use a mechanism to transfer Ether? Or is this
redundant because of ‘Wrapped Ether’ tokens? - Do you use
transfer
to only interact with EOA accounts or be
reentrant safe? - Do you avoid using
transfer
because it doesn’t forward all the
gas?