1.2.1 • Published 4 years ago

@emilianobonassi/gas-saver v1.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Gas Saver is a collection of smart contracts to save gas on Ethereum.

How it works

It defines a modifier that you can use to wrap the methods where you want to save gas burning gas tokens.

It uses Chi Gas tokens or GST2 Gas Tokens

Usage

Simply add the modifier to the methods you want, specifying the sponsor that will pay part of the gas using Gas tokens.

You have to approve your contract to spend Gas tokens on sponsor behalf (i.e. call approve)

Below an example with CHI tokens

import "@emilianobonassi/gas-saver/ChiGasSaver.sol";

contract MyContract is ChiGasSaver {

...

function myExpensiveMethod()
    external
    saveGas(msg.sender)
    returns (bool) {
        ...
    }
...

}

Below an example with GST2 tokens

import "@emilianobonassi/gas-saver/ChiGasSaver.sol";

contract MyContract is GST2GasSaver {

...

function myExpensiveMethod()
    external
    saveGas(msg.sender)
    returns (bool) {
        ...
    }
...

}