Skip to content

Commit

Permalink
Add constructor for gas report
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Aug 17, 2023
1 parent 771768a commit e6f5f27
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,19 @@ type GasReport struct {
UsedInternally uint64
}

// EmptyGasReport creates a new GasReport with the given limit and 0 gas used.
func EmptyGasReport(limit uint64) GasReport {
return NewGasReport(limit, 0)
}

// NewGasReport creates a new GasReport with the given limit and amount of gas used internally.
// UsedExternally is set to 0.
func NewGasReport(limit uint64, usedInternally uint64) GasReport {
return GasReport{
Limit: limit,
Remaining: limit,
Remaining: limit - usedInternally,
UsedExternally: 0,
UsedInternally: 0,
UsedInternally: usedInternally,
}
}

Expand Down

0 comments on commit e6f5f27

Please sign in to comment.