Our goal for this repo is to achieve the trade off between two tokens to the lowest possible values through UNISWAP V3 Router in node.js
- It is recommended to have some basic understanding of interaction with smart contracts through ABI making and making instances of contracts through Web3.js or ethers.js SDK:
- Run:
npm i
which will install the following npm packgesether
,@uniswap/sdk-core
,@uniswap/v3-sdk
, anddotenv
. - Accept all options and let the requirements install
- Add an
.env
file in the root directory. - Make sure you are in the
gametokenUniswaptrade1
directory. - Make sure your wallet secret key, wallet address and infura test url are filled
.env
file (see below). - make sure you have the same private RPc node for pair of tokens where you want to trade and filled in
.env
file as below.
Development Key Fields
- Binance:
INFURA_URL=<infura url>
WALLET_SECRET =<wallet private key>
WALLET_ADDRESS =<wallet public key>
you can learn how to have your public and private key fromMetmask
https://www.youtube.com/watch?v=qsvwg-cC928
- Make sure you are in the
gametokenUniswaptrade1
directory. - Run
node
onuniswapGameToUsdt.js
to trade Game token over USDT. - Run
node
onuniswapUsdToGame.js
to trade USDT token over Game. - TO know the pool addresse, Run
node
ongetUniswapPool.js
, copy the address from console or return to as output.
- (
gametokenUniswaptrade1/uniswapGameToUsdt.js
) -Trades Game over USDT - (
gametokenUniswaptrade1/uniswapUsdToGame.js
)- Trades USDT over Game.
- (
gametokenUniswaptrade1/getUniswapPool.js
) -Get you pool address of any two tokens (if exist). - Models (
gametokenUniswaptrade1/helpers.js
)- Where some generic functions are described
- UNISWAP Router -https://docs.uniswap.org/protocol/reference/deployments
- What is an ABI -https://www.quicknode.com/guides/solidity/what-is-an-abi
- How to create instance of smartcontraact with ethers.js sdk -https://docs.ethers.io/v5/api/contract/contract/
- Wallet instances in ethers.js SDK - https://docs.ethers.io/v5/api/signer/#Wallet-constructor
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate. ng the pool