-
Notifications
You must be signed in to change notification settings - Fork 392
/
ArbGasInfo.sol
121 lines (104 loc) · 4.52 KB
/
ArbGasInfo.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.4.21 <0.9.0;
/// @title Provides insight into the cost of using the chain.
/// @notice These methods have been adjusted to account for Nitro's heavy use of calldata compression.
/// Of note to end-users, we no longer make a distinction between non-zero and zero-valued calldata bytes.
/// Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006c.
interface ArbGasInfo {
/// @notice Get gas prices for a provided aggregator
/// @return return gas prices in wei
/// (
/// per L2 tx,
/// per L1 calldata unit, (a byte, non-zero or otherwise, is 16 units)
/// per storage allocation,
/// per ArbGas base,
/// per ArbGas congestion,
/// per ArbGas total
/// )
function getPricesInWeiWithAggregator(address aggregator)
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
);
/// @notice Get gas prices. Uses the caller's preferred aggregator, or the default if the caller doesn't have a preferred one.
/// @return return gas prices in wei
/// (
/// per L2 tx,
/// per L1 calldata unit, (a byte, non-zero or otherwise, is 16 units)
/// per storage allocation,
/// per ArbGas base,
/// per ArbGas congestion,
/// per ArbGas total
/// )
function getPricesInWei()
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
);
/// @notice Get prices in ArbGas for the supplied aggregator
/// @return (per L2 tx, per L1 calldata unit, per storage allocation)
function getPricesInArbGasWithAggregator(address aggregator)
external
view
returns (
uint256,
uint256,
uint256
);
/// @notice Get prices in ArbGas. Assumes the callers preferred validator, or the default if caller doesn't have a preferred one.
/// @return (per L2 tx, per L1 calldata unit, per storage allocation)
function getPricesInArbGas()
external
view
returns (
uint256,
uint256,
uint256
);
/// @notice Get the gas accounting parameters. `gasPoolMax` is always zero, as the exponential pricing model has no such notion.
/// @return (speedLimitPerSecond, gasPoolMax, maxTxGasLimit)
function getGasAccountingParams()
external
view
returns (
uint256,
uint256,
uint256
);
/// @notice Get the minimum gas price needed for a tx to succeed
function getMinimumGasPrice() external view returns (uint256);
/// @notice Get ArbOS's estimate of the L1 basefee in wei
function getL1BaseFeeEstimate() external view returns (uint256);
/// @notice Get how slowly ArbOS updates its estimate of the L1 basefee
function getL1BaseFeeEstimateInertia() external view returns (uint64);
/// @notice Deprecated -- Same as getL1BaseFeeEstimate()
function getL1GasPriceEstimate() external view returns (uint256);
/// @notice Get L1 gas fees paid by the current transaction
function getCurrentTxL1GasFees() external view returns (uint256);
/// @notice Get the backlogged amount of gas burnt in excess of the speed limit
function getGasBacklog() external view returns (uint64);
/// @notice Get how slowly ArbOS updates the L2 basefee in response to backlogged gas
function getPricingInertia() external view returns (uint64);
/// @notice Get the forgivable amount of backlogged gas ArbOS will ignore when raising the basefee
function getGasBacklogTolerance() external view returns (uint64);
/// @notice Returns the surplus of funds for L1 batch posting payments (may be negative).
function getL1PricingSurplus() external view returns (int256);
/// @notice Returns the base charge (in L1 gas) attributed to each data batch in the calldata pricer
function getPerBatchGasCharge() external view returns (int64);
/// @notice Returns the cost amortization cap in basis points
function getAmortizedCostCapBips() external view returns (uint64);
}