Typeberry by Fluffy Labs - v0.5.0
    Preparing search index...

    Interface IGasCounter

    An abstraction over gas counter.

    It can be optimized to use numbers instead of bigint in case of small gas.

    interface IGasCounter {
        initialGas: Gas;
        get(): Gas;
        set(g: Gas): void;
        sub(g: Gas): boolean;
        used(): Gas;
    }
    Index

    Properties

    Methods

    Properties

    initialGas: Gas

    Set during initialization of GasCounter.

    NOTE: Needed to calculate used() gas.

    Methods

    • Calculates used gas since creation of GasCounter.

      The interface does not handle negative or more than initialGas values.

      NOTE: We can use at most initialGas and as little as 0.

      Returns Gas