Skip to content

Commit

Permalink
[R4R]-{develop}-[gasoracle]impr: initialize fee_scalar metrics (#1346)
Browse files Browse the repository at this point in the history
Core changes:
- Query scalar from gas_oracle contract and initialize fee_scalar for metrics when gas_oracle starts
  • Loading branch information
Tri-stone committed Aug 15, 2023
1 parent 88f482e commit 894f76d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gas-oracle/oracle/base_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ func wrapUpdateBaseFee(l1Backend bind.ContractTransactor, l2Backend DeployContra
if err != nil {
return nil, err
}

// initialize some metrics
// initialize fee scalar from contract
feeScalar, err := contract.Scalar(&bind.CallOpts{
Context: context.Background(),
})
if err != nil {
return nil, err
}
ometrics.GasOracleStats.FeeScalarGauge.Update(feeScalar.Int64())

return func() error {
baseFee, err := contract.L1BaseFee(&bind.CallOpts{
Context: context.Background(),
Expand All @@ -84,7 +95,7 @@ func wrapUpdateBaseFee(l1Backend bind.ContractTransactor, l2Backend DeployContra
if err != nil {
return err
}
// Update faa scalar metrics
// Update fee scalar metrics
ometrics.GasOracleStats.FeeScalarGauge.Update(feeScalar.Int64())

// NOTE this will return base multiple with coin ratio
Expand Down

0 comments on commit 894f76d

Please sign in to comment.