update feeratemodel & test case

This commit is contained in:
杨新刚
2021-01-12 18:12:42 +08:00
parent b283a1c1f9
commit fa5180bcd8
9 changed files with 209 additions and 11 deletions

View File

@@ -37,6 +37,8 @@ export const PERMISSION_MANAGER_NAME = "PermissionManager"
export const EXTERNAL_VALUE_NAME = "ExternalValue"
export const DODO_PROXY_NAME = "DODOV2Proxy01"
export const FEE_RATE_MODEL_NAME = "FeeRateModel"
export const FEE_RATE_MODEL_LOGIC_NAME = "FeeRateModelLogic"
export const FEE_RATE_MODEL_LOGIC_UPDATE_NAME = "FeeRateModelLogicUpdate"
export const DPP_NAME = "DPP"
export const DPP_FACTORY_NAME = "DPPFactory"
export const SMART_APPROVE = "DODOApprove"

View File

@@ -57,6 +57,11 @@ export class DVMContext {
MtFeeRate: string;
SpareAccounts: string[];
mtFeeRateModel: Contract;
MtFeeRateModelLogic: Contract;
MtFeeRateModelLogicUpdate: Contract;
constructor() { }
async init(config: DVMContextInitConfig) {
@@ -64,8 +69,9 @@ export class DVMContext {
this.Web3 = getDefaultWeb3();
this.DVM = await contracts.newContract(contracts.DVM_NAME)
var lpFeeRateModel = await contracts.newContract(contracts.CONST_FEE_RATE_MODEL_NAME)
var mtFeeRateModel = await contracts.newContract(contracts.CONST_FEE_RATE_MODEL_NAME)
var lpFeeRateModel = await contracts.newContract(contracts.FEE_RATE_MODEL_NAME)
var mtFeeRateModel = await contracts.newContract(contracts.FEE_RATE_MODEL_NAME)
this.mtFeeRateModel = mtFeeRateModel;
this.MtFeeRate = mtFeeRateModel.options.address
var permissionManager = await contracts.newContract(contracts.PERMISSION_MANAGER_NAME)
var gasPriceSource = await contracts.newContract(contracts.EXTERNAL_VALUE_NAME)
@@ -103,6 +109,10 @@ export class DVMContext {
await lpFeeRateModel.methods.init(this.Deployer, config.lpFeeRate).send(this.sendParam(this.Deployer))
await mtFeeRateModel.methods.init(this.Deployer, config.mtFeeRate).send(this.sendParam(this.Deployer))
this.MtFeeRateModelLogic = await contracts.newContract(contracts.FEE_RATE_MODEL_LOGIC_NAME)
this.MtFeeRateModelLogicUpdate = await contracts.newContract(contracts.FEE_RATE_MODEL_LOGIC_UPDATE_NAME)
console.log(log.blueText("[Init DVM context]"));
}

View File

@@ -39,6 +39,8 @@ export class ProxyContext {
//Functions
DODOIncentive: Contract;
MtFeeRateModelLogic: Contract;
MtFeeRateModelLogicUpdate: Contract;
Deployer: string;
Maintainer: string;
@@ -78,8 +80,8 @@ export class ProxyContext {
var dppAdminTemplate = await contracts.newContract(contracts.DPP_ADMIN_NAME)
var permissionManagerTemplate = await contracts.newContract(contracts.PERMISSION_MANAGER_NAME)
var mtFeeRateModelTemplate = await contracts.newContract(contracts.FEE_RATE_MODEL_NAME)
// await mtFeeRateModelTemplate.methods.init(this.Deployer,decimalStr("0.01")).send(this.sendParam(this.Deployer));
await mtFeeRateModelTemplate.methods.init(this.Deployer,decimalStr("0")).send(this.sendParam(this.Deployer));
await mtFeeRateModelTemplate.methods.init(this.Deployer,decimalStr("0.01")).send(this.sendParam(this.Deployer));
// await mtFeeRateModelTemplate.methods.init(this.Deployer,decimalStr("0")).send(this.sendParam(this.Deployer));
this.DVMFactory = await contracts.newContract(contracts.DVM_FACTORY_NAME,
[
@@ -150,6 +152,11 @@ export class ProxyContext {
[this.WETH.options.address]
)
this.MtFeeRateModelLogic = await contracts.newContract(contracts.FEE_RATE_MODEL_LOGIC_NAME)
this.MtFeeRateModelLogicUpdate = await contracts.newContract(contracts.FEE_RATE_MODEL_LOGIC_UPDATE_NAME)
console.log(log.blueText("[Init DVM context]"));
}