route and wrap and unwrap eth && test

This commit is contained in:
owen05
2020-11-13 15:48:55 +08:00
parent 69658fc9fa
commit abd2b8aea2
13 changed files with 643 additions and 34 deletions

View File

@@ -116,9 +116,10 @@ export class DODOContext {
["USDC", 6]
);
this.WETH = await contracts.newContract(
contracts.TEST_ERC20_CONTRACT_NAME,
["WETH", 18]
contracts.WETH_CONTRACT_NAME
);
//创建交易对
//DODO-USDT
this.DODO_USDT_ORACLE = await contracts.newContract(
@@ -223,7 +224,7 @@ export class DODOContext {
this.SmartSwap = await contracts.newContract(
contracts.SMART_SWAP,
[this.SmartApprove.options.address,this.DODOSellHelper.options.address]
[this.SmartApprove.options.address,this.DODOSellHelper.options.address,this.WETH.options.address]
);
await this.SmartApprove.methods.setSmartSwap(this.SmartSwap.options.address).send(this.sendParam(this.Deployer));
@@ -247,12 +248,13 @@ export class DODOContext {
}
async mintToken(tokenBase:Contract,tokenQuote:Contract,to: string, base: string, quote: string) {
await tokenBase.methods.mint(to, base).send(this.sendParam(this.Deployer));
await tokenQuote.methods
.mint(to,  quote)
.send(this.sendParam(this.Deployer));
if(tokenBase != null)
await tokenBase.methods.mint(to, base).send(this.sendParam(this.Deployer));
if(tokenQuote != null)
await tokenQuote.methods.mint(to,  quote).send(this.sendParam(this.Deployer));
}
async approvePair(tokenBase:Contract,tokenQuote:Contract, approveTarget:string,account: string) {
await tokenBase.methods
.approve(approveTarget, MAX_UINT256)

View File

@@ -17,7 +17,6 @@ const CloneFactory = require(`${jsonPath}CloneFactory.json`)
const DODO = require(`${jsonPath}DODO.json`)
const DODOZoo = require(`${jsonPath}DODOZoo.json`)
const DODOEthProxy = require(`${jsonPath}DODOEthProxy.json`)
const WETH = require(`${jsonPath}WETH9.json`)
const TestERC20 = require(`${jsonPath}TestERC20.json`)
const NaiveOracle = require(`${jsonPath}NaiveOracle.json`)
const DODOLpToken = require(`${jsonPath}DODOLpToken.json`)
@@ -31,6 +30,7 @@ const LockedTokenVault = require(`${jsonPath}LockedTokenVault.json`)
const SmartSwap = require(`${jsonPath2}SmartSwap.json`)
const SmartApprove = require(`${jsonPath2}SmartApprove.json`)
const DODOSellHelper = require(`${jsonPath2}DODOSellHelper.json`)
const WETH = require(`${jsonPath2}WETH9.json`)
/******/
import { getDefaultWeb3 } from './EVM';