Skip to content

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

License

Notifications You must be signed in to change notification settings

emilianobonassi/gas-saver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gas Saver

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) {
        ...
    }
...

}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published