Yield Mode | Description |
---|---|
AUTOMATIC | ETH balance automatically rebases (increasing only) |
VOID | ETH balance never changes in response to yield; no yield is earned |
CLAIMABLE | Yield accumulates separately and can be claimed to any recipient address |
AUTOMATIC
yield mode, which means their ETH balances will rebase automatically.
However, when a smart contract is deployed to an address, the account is switched to VOID
mode. In practice, this means that smart contract accounts default to VOID
mode and EOAs default to AUTOMATIC
mode.
0x4300000000000000000000000000000000000002
.
See our article on Receiving and claiming ETH Yield for details.
op-geth
(blast-geth
) to represent balances in terms of shares and enable all accounts to update as yield is reported. More specifically, blast-geth
modifies the underlying StateAccount
struct that represents account state to accomplish this:
Flags
field and the Fixed
, Shares
, and Remainder
fields store the data required to calculate account balances in each of the three yield modes as follows:
AUTOMATIC
mode, balances increase automatically as yield is reported to the L2:account.remainder
will be a dusty value to enable wei-level precision.account.remainder < sharePrice
(otherwise, account.shares
would just be higher).BALANCE
opcode behaves the same as it normally does, so smart contracts don’t need to consider their account’s shares.
To remain EVM compatible, Blast’s share system guarantees wei-level precision, allowing accounts with rebasing balances to transfer precise amounts of wei to accounts with non-rebasing balances and vice versa.
0x4300000000000000000000000000000000000000
.
This contract tracks the share price, the total number of shares, and the total amount of ETH that has yet to be reflected in the share price. You can read the current ETH share price by calling SharesBase::price()
as demonstrated below using cast call
or the eth_call
RPC:
awk
and jq
for styling purposes to show the units of the return value.NewPrice(uint256 price)
event emitted by this contract to get the new global share price whenever an update occurs. Generally, this update happens every day at midnight UTC, but this schedule is not guaranteed in code and may be subject to change.
eth_getBalance
RPC method, but on Blast we need to be able to read and save the account’s shares
value instead. Blast nodes expose a new RPC method, eth_getBalanceValues
, to support indexing the flags
, shares
, remainder
, and fixed
fields for accounts.
eth_getBalanceValues
StateAccount
struct.
eth_getBalance
eth_getBalance
; hex or “latest”
, “pending”
, etcfixed
, flags
, remainder
, and shares
selfdestruct
allows ETH to be sent to a beneficiary address without triggering any code at that address. As a result, the beneficiary account’s balance changes without there being any call
made. Indexers must handle this edge case to ensure perfect accounting.
Blast introduces a similar edge case that indexers should be aware of. Accounts set to CLAIMABLE
yield mode can claim accumulated yield to an arbitrary beneficiary address. This claim operation works the same as selfdestruct
in that it can increase an arbitrary account’s balance without a call
.
While this edge case is exceptionally rare and not particularly important to handle, we include it here for completeness.