Motivation
In the Ethereum blockchain, the value of Ether and Gas has always been determined by the market - the cap of which saw a 10x change over the past year. With the ETH/USD at its all-time high and tons of extremely active DeFi projects, the transaction fees we pay in Gas proves to be both unpredictable and high for the near future. While the Ethereum Community’s proposed solutions like EIP-1559 are still in the works, the best mitigation for high gas fees in the meantime is using CHI Gastoken.
Concept
Since the EVM now gives a gas refund when freeing contract storage or destroying child contracts, one can “bank” their gas by e.g. creating many dummy child contracts, then destroying them when making their desired expensive message call. Gastokens are a class of ERC20 tokens that encapsulate that action inside their token mint and token burn functions. The fact that minting can take place at any time - preferably during the network’s downtime with low overall gas price & overall transaction count - and does not need to be confirmed quickly further enables the developer to mitigate the impact of gas fee fluctuation through good planning.
CHI Token by 1Inch exchange is currently the most efficient actively-used Gastoken.
Learn more about CHI Gastoken in their original post.
Objective
- Update the Bridge Vault contract to use CHI token to reduce gas cost for expensive functions
ETH/Token Unshielding is the most gas-intensive action in Incognito’s Bridge right now, costing upwards of 50$ each Unshield call. If necessary, the deployment of our future contracts can be made cheaper using CHI token as well.
- Devise a CHI minting strategy
- Keep all contract functions agnostic to the CHI token usage
The update should not make core functions dependent on CHI. Functions should proceed as before in the case no CHI is available; plus it should be easy for a future upgrade to move away from this gas token in favor of a better gas solution, if one arises.
Timeline
- Feb 2021
- Code working prototype for the contract update
- Create unit tests for relevant app flows in local & test environments
- Prepare scripts for upgrading & minting CHI
- Mar 2021
- Review contract and tests
- Deploy to test network; measure & extrapolate the gas saving with CHI token
- Deploy the upgrade to mainnet environment