diff --git a/core/types/balance.go b/core/types/balance.go new file mode 100644 index 0000000000..9c8c005d46 --- /dev/null +++ b/core/types/balance.go @@ -0,0 +1,47 @@ +package types + +//go:generate stringer -type=BalanceChangeReason + +// BalanceChangeReason describes the reason why an account's balance was changed in a transaction +type BalanceChangeReason uint8 + +const ( + // ValidatorReward is the balance change caused by the block validator reward + ValidatorReward BalanceChangeReason = iota + + // EmptyAccountByCode0 is the balance change caused by the empty account by code0 rule + EmptyAccountByCode0 + + // StartNonce is the balance change caused by the start nonce + StartNonce + + // GasRefund is the balance change caused by refunding gas + GasRefund + + // BalanceMint is for balance minting operations + BalanceMint + + // BalanceBurn is for balance burning operations + BalanceBurn + + // BlockReward is for block mining reward + BlockReward + + // FeeTip is for transaction fee tips + FeeTip + + // UncleReward is for uncle block rewards + UncleReward + + // TransactionFee is for transaction fees + TransactionFee + + // L1Fee is for Layer 1 fees + L1Fee + + // Deposit is for deposits + Deposit + + // BaseFeeBurn is for base fee burning + BaseFeeBurn +) \ No newline at end of file diff --git a/core/types/balance_change_string.go b/core/types/balance_change_string.go new file mode 100644 index 0000000000..000e9eb701 --- /dev/null +++ b/core/types/balance_change_string.go @@ -0,0 +1,16 @@ +// Code generated by "stringer -type=BalanceChangeReason"; DO NOT EDIT. + +package types + +import "strconv" + +const _BalanceChangeReason_name = "ValidatorRewardEmptyAccountByCode0StartNonceGasRefundBalanceMintBalanceBurnBlockRewardFeeTipUncleRewardTransactionFeeL1FeeDepositBaseFeeBurn" + +var _BalanceChangeReason_index = [...]uint8{0, 15, 31, 44, 53, 64, 75, 87, 94, 105, 119, 125, 134, 146} + +func (i BalanceChangeReason) String() string { + if i >= BalanceChangeReason(len(_BalanceChangeReason_index)-1) { + return "BalanceChangeReason(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _BalanceChangeReason_name[_BalanceChangeReason_index[i]:_BalanceChangeReason_index[i+1]] +} \ No newline at end of file