DEV Community

Marques Traylor
Marques Traylor

Posted on

ShadowGas - Store

I have finished the Store feature of the ShadowGas contract.

Interaction with the contract can be done via buidler tasks and the console.

Install

git clone https://github.com/TraylorBoy/ShadowGas.git

cd ShadowGas

yarn install
Enter fullscreen mode Exit fullscreen mode

After installing, you will need to create a .env file and modify the shadow.config.js and the buidler.config.js files

.env

SHADOWGAS="" - Contract Address
WALLET="" - Wallet Address
PRIVATEKEY="" - Wallet Private Key
KOVAN="" - Kovan Infura url
ROPSTEN="" - Ropsten Infura url
MAINNET="" - Mainnet Infura url
ETHERSCAN="" - Etherscan API Key
ETH_GAS_STATION="" - EthGasStation API Key
Enter fullscreen mode Exit fullscreen mode

shadow.config.json

RefuelChiAmt - Mint Chi Amount
RefuelLgtAmt - Mint Lgt Amount
EmptyChiAmt - Transfer Chi Amount
EmptyLgtAmt - Transfer Lgt Amount
EmptyChiTo - Address to transfer Chi to
EmptyLgtTo - Address to transfer Lgt to
GasLimit - Gas Limit
GasSpeed - Gas Speed ("fast", "average", "slow") 
Enter fullscreen mode Exit fullscreen mode

Gas Price is retrieved from:

https://ethgasstation.info/
https://etherscan.io/gastracker

I am working on a Gas Oracle which may change this feature

buidler.config.js

...

module.exports = {
  defaultNetwork: "Kovan",
  ...
 }
Enter fullscreen mode Exit fullscreen mode

You may modify the exported properties in the buidler.config.js file.

Store

<GAS_TOKEN> should be either: Chi or Lgt

Refuel

npx buidler refuel --token <GAS_TOKEN>
Enter fullscreen mode Exit fullscreen mode

Mints either Chi or Lgt tokens and stores them at contract's address

Tank

npx buidler tank --token <GAS_TOKEN>
Enter fullscreen mode Exit fullscreen mode

Retrieves Chi or Lgt token balance at contract's address

Examples

Refuel 13 Chi and Lgt tokens

Refuel amount can be modified via the shadow.config.js file

npx buidler refuel --token Chi
Enter fullscreen mode Exit fullscreen mode

Alt Text

npx buidler refuel --token Lgt
Enter fullscreen mode Exit fullscreen mode

Alt Text

Retrieve Chi and Lgt tank balances

npx buidler tank --token Chi
Enter fullscreen mode Exit fullscreen mode

Alt Text

npx buidler tank --token Lgt
Enter fullscreen mode Exit fullscreen mode

Alt Text

I will post the Transfer feature tomorrow!

The repo for the project is located here: https://github.com/TraylorBoy/ShadowGas

Discussion (0)