Browse Source

build univ3 name.

skyfffire 3 years ago
parent
commit
2d1a625393
2 changed files with 12 additions and 1 deletions
  1. 1 1
      scripts/lp/lpGenerate.ts
  2. 11 0
      test/BaseOperationTest.ts

+ 1 - 1
scripts/lp/lpGenerate.ts

@@ -79,7 +79,7 @@ export class LpGenerate {
 
       const symbol0 = info.symbol0.replace(/[^A-Za-z0-9 ]+/g, '').substring(0, 10)
       const symbol1 = info.symbol1.replace(/[^A-Za-z0-9 ]+/g, '').substring(0, 10)
-      const name = `${routerObj.router.slice(2, 4) + routerObj.router.slice(-2)}_${symbol0}_${symbol1}`
+      const name = `${routerObj.name}_${symbol0}_${symbol1}`
       const sum2 = replaceAll(BigNumber.from(positionInfo.token0).add(BigNumber.from(positionInfo.token1))._hex, '0x0', '0x')
 
       const lp = {

+ 11 - 0
test/BaseOperationTest.ts

@@ -1,6 +1,7 @@
 import { web3 } from "hardhat"
 import deployer from '../.secret'
 import contracts from '../config/contracts'
+import logger from "../utils/logger";
 
 describe('Base operation test', () => {
   it('Parse ether test', async () => {
@@ -60,4 +61,14 @@ describe('Base operation test', () => {
 
     await weth_contract.methods.approve(contracts.UNIV3, 1e18.toString()).send(rawTx).then(console.log)
   })
+
+  it ('IERC20 name test', async () => {
+    const IERC20_ABI = require('../abi/IERC20_ABI.json')
+    const IERC20_ADDRESS = web3.utils.toChecksumAddress('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48')
+
+    let ierc20_contract = new web3.eth.Contract(IERC20_ABI, IERC20_ADDRESS)
+
+    logger.debug(await ierc20_contract.methods.name().call())
+    logger.debug(await ierc20_contract.methods.symbol().call())
+  })
 })