trade incentive && dodov1proxy02

This commit is contained in:
owen05
2021-01-06 18:02:44 +08:00
parent 517d4ae977
commit 66ab633d41
9 changed files with 697 additions and 195 deletions

View File

@@ -28,11 +28,13 @@ const DODOMineReader = require(`${jsonPath}DODOMineReader.json`)
const LockedTokenVault = require(`${jsonPath}LockedTokenVault.json`)
/*v1.5 */
const SmartSwap = require(`${jsonPath2}DODOV1Proxy01.json`)
const SmartSwap02 = require(`${jsonPath2}DODOV1Proxy02.json`)
const SmartApprove = require(`${jsonPath2}DODOApprove.json`)
const DODOSellHelper = require(`${jsonPath2}DODOSellHelper.json`)
const WETH = require(`${jsonPath2}WETH9.json`)
const CHI = require(`${jsonPath2}ChiToken.json`)
const DODOSwapCalcHelper = require(`${jsonPath2}DODOSwapCalcHelper.json`)
const DODOIncentive = require(`${jsonPath2}DODOIncentive.json`)
/******/
import { getDefaultWeb3 } from './EVM';
@@ -55,10 +57,12 @@ export const DODO_MINE_NAME = "DODOMine"
export const DODO_MINE_READER_NAME = "DODOMineReader"
/*v1.5 */
export const SMART_SWAP = "DODOV1Proxy01"
export const SMART_SWAP_02 = "DODOV1Proxy02"
export const SMART_APPROVE = "DODOApprove"
export const DODO_SELL_HELPER = "DODOSellHelper"
export const CHI_TOKEN = "ChiToken"
export const DODO_SWAP_CALC_HELPER = "DODOSwapCalcHelper"
export const DODO_INCENTIVE = "DODOIncentive"
/******/
var contractMap: { [name: string]: any } = {}
@@ -78,10 +82,12 @@ contractMap[DODO_MINE_NAME] = DODOMine
contractMap[DODO_MINE_READER_NAME] = DODOMineReader
/*v1.5 */
contractMap[SMART_SWAP] = SmartSwap
contractMap[SMART_SWAP_02] = SmartSwap02
contractMap[SMART_APPROVE] = SmartApprove
contractMap[DODO_SELL_HELPER] = DODOSellHelper
contractMap[CHI_TOKEN] = CHI
contractMap[DODO_SWAP_CALC_HELPER] = DODOSwapCalcHelper
contractMap[DODO_INCENTIVE] = DODOIncentive
/******/
interface ContractJson {

View File

@@ -71,11 +71,14 @@ export class DODOContext {
DODO_USDT_ORACLE: Contract;
USDT_USDC_ORACLE: Contract;
WETH_USDC_ORACLE: Contract;
DODOProxyV1: Contract;
DODOV1Proxy01: Contract;
DODOV1Proxy02: Contract;
DODOApprove: Contract;
DODOSellHelper: Contract;
//Helper
DODOSwapCalcHelper: Contract;
//Functions
DODOIncentive: Contract;
constructor() { }
@@ -224,6 +227,12 @@ export class DODOContext {
contracts.SMART_APPROVE
);
//DODO Incentive
this.DODOIncentive = await contracts.newContract(
contracts.DODO_INCENTIVE,
[this.DODO.options.address]
)
//Gas Token
this.CHI = await contracts.newContract(
contracts.CHI_TOKEN
@@ -231,18 +240,25 @@ export class DODOContext {
// await this.CHI.methods.mint(140).send(this.sendParam(this.Deployer));
this.DODOProxyV1 = await contracts.newContract(
this.DODOV1Proxy01 = await contracts.newContract(
contracts.SMART_SWAP,
[this.DODOApprove.options.address, this.DODOSellHelper.options.address, this.WETH.options.address, this.CHI.options.address]
// [this.DODOApprove.options.address, this.DODOSellHelper.options.address, this.WETH.options.address, "0x0000000000000000000000000000000000000000"]
);
await this.DODOProxyV1.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOApprove.methods.init(this.Deployer,this.DODOProxyV1.options.address).send(this.sendParam(this.Deployer));
this.DODOV1Proxy02 = await contracts.newContract(
contracts.SMART_SWAP_02,
[this.DODOApprove.options.address, this.DODOSellHelper.options.address, this.WETH.options.address, this.CHI.options.address,this.DODOIncentive.options.address]
// [this.DODOApprove.options.address, this.DODOSellHelper.options.address, this.WETH.options.address, "0x0000000000000000000000000000000000000000"]
);
// await this.CHI.methods.transfer(this.DODOProxyV1.options.address,140).send(this.sendParam(this.Deployer));
await this.DODOV1Proxy01.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOV1Proxy02.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOIncentive.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOApprove.methods.init(this.Deployer,this.DODOV1Proxy02.options.address).send(this.sendParam(this.Deployer));
await this.DODOIncentive.methods.changeDODOProxy(this.DODOV1Proxy02.options.address).send(this.sendParam(this.Deployer));
this.DODOSwapCalcHelper = await contracts.newContract(
contracts.DODO_SWAP_CALC_HELPER,[this.DODOSellHelper.options.address]
);