|
@@ -4,8 +4,10 @@ import deployer from "../.secret";
|
|
|
import fee from "../config/fee";
|
|
import fee from "../config/fee";
|
|
|
|
|
|
|
|
describe('Uniswap v3 test', () => {
|
|
describe('Uniswap v3 test', () => {
|
|
|
|
|
+ let inAmount = 1e15.toString()
|
|
|
|
|
+
|
|
|
it('Univ3 swap test', async () => {
|
|
it('Univ3 swap test', async () => {
|
|
|
- const UNIV3_ABI = require('../abi/UNIV3_ABI.json')
|
|
|
|
|
|
|
+ const UNIV3_ABI = require('../abi/UNIV3_ROUTER_ABI.json')
|
|
|
|
|
|
|
|
let univ3_contract = new web3.eth.Contract(UNIV3_ABI, contracts.UNIV3)
|
|
let univ3_contract = new web3.eth.Contract(UNIV3_ABI, contracts.UNIV3)
|
|
|
|
|
|
|
@@ -16,7 +18,7 @@ describe('Uniswap v3 test', () => {
|
|
|
gasLimit: 1_000_000
|
|
gasLimit: 1_000_000
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let amountIn = 1_000_000
|
|
|
|
|
|
|
+ let amountIn = inAmount
|
|
|
let amountOutMin = 1
|
|
let amountOutMin = 1
|
|
|
let path = [contracts.WETH, contracts.HEX]
|
|
let path = [contracts.WETH, contracts.HEX]
|
|
|
let to = deployer.address
|
|
let to = deployer.address
|
|
@@ -27,7 +29,7 @@ describe('Uniswap v3 test', () => {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('Univ3 `exactInput` test', async () => {
|
|
it('Univ3 `exactInput` test', async () => {
|
|
|
- const UNIV3_ABI = require('../abi/UNIV3_ABI.json')
|
|
|
|
|
|
|
+ const UNIV3_ABI = require('../abi/UNIV3_ROUTER_ABI.json')
|
|
|
|
|
|
|
|
let univ3_contract = new web3.eth.Contract(UNIV3_ABI, contracts.UNIV3)
|
|
let univ3_contract = new web3.eth.Contract(UNIV3_ABI, contracts.UNIV3)
|
|
|
|
|
|
|
@@ -38,7 +40,6 @@ describe('Uniswap v3 test', () => {
|
|
|
gasLimit: 1e6
|
|
gasLimit: 1e6
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let amountIn = 1e17.toString()
|
|
|
|
|
let amountOutMin = 1
|
|
let amountOutMin = 1
|
|
|
let deadline = parseInt(String(new Date().getTime() / 1e3)) + 60
|
|
let deadline = parseInt(String(new Date().getTime() / 1e3)) + 60
|
|
|
let path = [contracts.WETH, fee._30_per_10000, contracts.USDT]
|
|
let path = [contracts.WETH, fee._30_per_10000, contracts.USDT]
|
|
@@ -48,7 +49,7 @@ describe('Uniswap v3 test', () => {
|
|
|
path: ethers.utils.solidityPack(['address', 'uint24', 'address'], path),
|
|
path: ethers.utils.solidityPack(['address', 'uint24', 'address'], path),
|
|
|
recipient: to,
|
|
recipient: to,
|
|
|
deadline: deadline,
|
|
deadline: deadline,
|
|
|
- amountIn: amountIn,
|
|
|
|
|
|
|
+ amountIn: inAmount,
|
|
|
amountOutMinimum: amountOutMin
|
|
amountOutMinimum: amountOutMin
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -56,4 +57,14 @@ describe('Uniswap v3 test', () => {
|
|
|
.exactInput(params)
|
|
.exactInput(params)
|
|
|
.send(rawTx).then(console.log)
|
|
.send(rawTx).then(console.log)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ it('Quoter calc test', async () => {
|
|
|
|
|
+ const QUOTER_ABI = require('../abi/QUOTER_ABI.json')
|
|
|
|
|
+
|
|
|
|
|
+ let quoter = new web3.eth.Contract(QUOTER_ABI, contracts.QUOTER)
|
|
|
|
|
+
|
|
|
|
|
+ await quoter.methods
|
|
|
|
|
+ .quoteExactInputSingle(contracts.WETH, contracts.USDT, fee._30_per_10000, inAmount, 0)
|
|
|
|
|
+ .call().then(console.log)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|