Adds a new PAY
opcode to send ether without transferring execution context.
value
of ether
tokens
between accounts:
<address>.send
<address>.transfer
<address>.call{value}
via the CALL
opcode<address>.send
and <address>.transfer
, because these forward a fixed 2300
gas (and gas costs for common operations periodically change, forcing backwards incompatibility).<address>
, enabling
reentrancy
and
Denial of service (DoS)
attack vectors if a developer is not cautious.
Historically, this has led to billions of
dollars of smart contract exploits.
PAY
, that takes two stack parameters, addr
and val
, transferring val
wei
into addr
, without calling any of its functions. In this way, developers
can easily transfer ether without transferring execution context.
Constant | Definition |
---|---|
WARM_STORAGE_READ_COST | EIP-2929 |
COLD_ACCOUNT_ACCESS_COST | EIP-2929 |
GAS_NEW_ACCOUNT | EELS |
GAS_CALL_VALUE | EELS |
PAY
(0xf9
), which:
addr
then val
val
wei from the current target address to the address addr
addr
as warm (adding addr
to accessed_addresses
)PAY
is the sum of the following:
addr
in accessed_addresses
?
WARM_STORAGE_READ_COST
;COLD_ACCOUNT_ACCESS_COST
.addr
exist or is val
zero?
GAS_NEW_ACCOUNT
.val
zero?
GAS_CALL_VALUE
.PAY
cannot be implemented on networks with empty accounts (see
EIP-7523).