You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
I am using v2 sdk for one of the project and and creating trade instance with one of my token (USDT in Goerli). The instance work perfectly with WETH. however it is not working with USDT.
Hi,
I am using v2 sdk for one of the project and and creating trade instance with one of my token (USDT in Goerli). The instance work perfectly with WETH. however it is not working with USDT.
here is my code.
const chainId = ChainId.GOERLI
const web3 = new Web3(new Web3.providers.HttpProvider("https://goerli.infura.io/v3/2d0256aba07e4704add58fd0713e24d5"))
const poolAbi = poolAbi
const USDT = new Token(chainId, '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', 18, 'USDT', 'Tether')
async function createPair() {
const pairAddress = Pair.getAddress(USDT, WETH9[USDT.chainId])
// Setup provider, import necessary ABI ...
const pairContract = new web3.eth.Contract(poolAbi,pairAddress)
const reserves = await pairContract.methods"getReserves".call()
const {reserve0, reserve1} = reserves
const tokens = [USDT, WETH9[USDT.chainId]]
const [token0, token1] = tokens[0].sortsBefore(tokens[1]) ? tokens : [tokens[1], tokens[0]]
const pair = new Pair(CurrencyAmount.fromRawAmount(token0, reserve0.toString()), CurrencyAmount.fromRawAmount(token1, reserve0.toString()))
return pair
}
const abc = async (sellAmount) => {
try {
const pair = await createPair()
console.log('pair', pair)
}
abc('100')
The text was updated successfully, but these errors were encountered: