ShadowGas - Trade

traylorboy profile image Marques Traylor Updated on ・2 min read

v1.0.0 of the ShadowGas smart contract is finished. My two recent posts (below) go over the Store and Transfer features of the contract and this one will go over the Trade feature.



The Trade feature currently only trades the liquid gas token, however I plan on including the other 2 later down the road

Updated the shadowGas.config.json file


`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") 
`TradeLimit` - The amount of trades to perform
`LgtTradeAmount` - Amount of LGT Tokens to trade


Only trades LGT, but can use refueled CHI for discounts so profit may be more than expected if discount is applied


npx buidler oracle

Will retrieve trade information for arbitrage


npx buidler arbitrage

Will run a loop to continuously check for trade opportunities every minute and will execute trades if an opportunity is found until TradeLimit is reached


Check for trade opportunity

npx buidler oracle

Alt Text

If the costToMint > expectedProfit, no opportunity found

Testing the Arbitrage Strategy

Since the costToMint is heavily weighted by the current gasPrice, by changing the gasPrice variable (ex. 1 Gwei) on a testnet, you will be able to mint the LGT tokens for cheap and sell them for a profit within the same transaction since the costToMint will be much lower when minting at 1 Gwei than at 116 Gwei thus forcing a trade opportunity.

npx buidler arbitrage

Alt Text

v1.0.0 for the ShadowGas contract is released; after adding GST compatibility (v1.1.0), I will be developing the UI in React in order to interact with the contract!

The repo can be found here: https://github.com/TraylorBoy/ShadowGas


Editor guide