wait to test
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
// import * as assert from 'assert';
|
||||
|
||||
import { decimalStr, gweiStr } from '../utils/Converter';
|
||||
import { logGas } from '../utils/Log';
|
||||
import { DVMContext, getDVMContext } from '../utils/DVMContext';
|
||||
import { assert } from 'chai';
|
||||
import { EXTERNAL_VALUE_NAME, getContractWithAddress } from '../utils/Contracts';
|
||||
const truffleAssert = require('truffle-assertions');
|
||||
|
||||
let lp: string;
|
||||
let trader: string;
|
||||
|
||||
async function init(ctx: DVMContext): Promise<void> {
|
||||
lp = ctx.SpareAccounts[0];
|
||||
trader = ctx.SpareAccounts[1];
|
||||
|
||||
// await ctx.mintTestToken(lp, decimalStr("10"), decimalStr("1000"));
|
||||
// await ctx.mintTestToken(trader, decimalStr("10"), decimalStr("1000"));
|
||||
|
||||
// await ctx.transferBaseToDVM(lp, decimalStr("10"))
|
||||
// await ctx.DVM.methods.buyShares(lp).send(ctx.sendParam(lp))
|
||||
}
|
||||
|
||||
describe("FeeratemodelUpdate", () => {
|
||||
let snapshotId: string;
|
||||
let ctx: DVMContext;
|
||||
|
||||
before(async () => {
|
||||
ctx = await getDVMContext();
|
||||
await init(ctx);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
snapshotId = await ctx.EVM.snapshot();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await ctx.EVM.reset(snapshotId);
|
||||
});
|
||||
|
||||
describe("Feeratemodel", () => {
|
||||
|
||||
it("feeRateUpdate", async () => {
|
||||
var feeRate = await ctx.DVM.methods.getUserFeeRate(lp).call()
|
||||
console.log(feeRate[1])//1000000000000000
|
||||
assert.equal(
|
||||
feeRate[1],
|
||||
"1000000000000000"
|
||||
);
|
||||
|
||||
console.log('~~~~~~~~~~~~~~~~~start set new feerate~~~~~~~~~~~~~~~~~')
|
||||
var feerateLogicAddress = ctx.MtFeeRateModelLogic.options.address;
|
||||
|
||||
await ctx.mtFeeRateModel.methods.setFeeRate(decimalStr("0.003"),feerateLogicAddress).send(ctx.sendParam(ctx.Deployer))
|
||||
var feeRateSet = await ctx.DVM.methods.getUserFeeRate(lp).call()
|
||||
console.log(feeRateSet[1])
|
||||
assert.equal(
|
||||
feeRateSet[1],
|
||||
"3000000000000000"
|
||||
);
|
||||
console.log('~~~~~~~~~~~~~~~~~start update feerateModel~~~~~~~~~~~~~~~~~')
|
||||
//no updatefile.sol found
|
||||
// var feerateLogicUpdateAddress = ctx.MtFeeRateModelLogicUpdate.options.address;
|
||||
// await ctx.mtFeeRateModel.methods.setFeeRate(decimalStr("0.001"),feerateLogicUpdateAddress).send(ctx.sendParam(ctx.Deployer))
|
||||
// var feeRateUpdate = await ctx.DVM.methods.getUserFeeRate(lp).call()
|
||||
// console.log(feeRateUpdate[1])
|
||||
// assert.equal(
|
||||
// feeRateUpdate[1],
|
||||
// "4000000000000000"
|
||||
// );
|
||||
// console.log('~~~~~~~~~~~~~~~~~set feeMapping[trader] ==0 ~~~~~~~~~~~~~~~~~')
|
||||
// await ctx.mtFeeRateModel.methods.setSpecificFeeRate(trader,decimalStr("0.001"),feerateLogicUpdateAddress).send(ctx.sendParam(ctx.Deployer))
|
||||
// var feeRateTrader = await ctx.DVM.methods.getUserFeeRate(trader).call()
|
||||
// console.log(feeRateTrader[1])
|
||||
// assert.equal(// if(feeMapping[trader] == 0) return _FEE_RATE_;
|
||||
// feeRateUpdate[1],
|
||||
// "4000000000000000"
|
||||
// );
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -131,35 +131,7 @@ describe("DODOProxyV2.0", () => {
|
||||
|
||||
|
||||
});
|
||||
it("updateFeeRateModel", async () => {
|
||||
var feeRate = await DVM_DODO_USDT.methods.getUserFeeRate(project).call()
|
||||
assert.equal(
|
||||
feeRate[1], //mtFee
|
||||
"0"
|
||||
);
|
||||
var mtFeeResult0 = await DVM_DODO_USDT.methods.querySellQuote(ctx.Deployer, decimalStr("10")).call()
|
||||
assert.equal(
|
||||
mtFeeResult0[1],
|
||||
"0"
|
||||
);
|
||||
|
||||
var feerateLogicAddress = ctx.MtFeeRateModelLogic.options.address;
|
||||
await logGas(await ctx.mtFeeRateModel.methods.setFeeRate(
|
||||
decimalStr("0.03"),
|
||||
feerateLogicAddress
|
||||
), ctx.sendParam(ctx.Deployer), "setFeeRate");
|
||||
var feeRateSet = await DVM_DODO_USDT.methods.getUserFeeRate(project).call()
|
||||
assert.equal(
|
||||
feeRateSet[1],
|
||||
"30000000000000000"
|
||||
);
|
||||
var mtFeeResult1 = await DVM_DODO_USDT.methods.querySellQuote(ctx.Deployer, decimalStr("10")).call()
|
||||
assert.equal(
|
||||
mtFeeResult1[1],
|
||||
"2999999997797182956530"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// it("createDVM - ETH", async () => {
|
||||
// var baseToken = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
// var quoteToken = ctx.USDT.options.address;
|
||||
|
||||
@@ -37,8 +37,6 @@ 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"
|
||||
|
||||
@@ -130,7 +130,6 @@ export class CPContext {
|
||||
).send(this.sendParam(this.Deployer))
|
||||
|
||||
await defaultGasSource.methods.init(this.Deployer, MAX_UINT256).send(this.sendParam(this.Deployer));
|
||||
await feeRateModel.methods.init(this.Deployer, decimalStr("0.001")).send(this.sendParam(this.Deployer));
|
||||
|
||||
console.log(log.blueText("[Init CrowdPooling context]"));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ export class DVMContext {
|
||||
|
||||
mtFeeRateModel: Contract;
|
||||
|
||||
MtFeeRateModelLogic: Contract;
|
||||
|
||||
constructor() { }
|
||||
|
||||
@@ -106,12 +105,8 @@ export class DVMContext {
|
||||
|
||||
await gasPriceSource.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer))
|
||||
await gasPriceSource.methods.set(MAX_UINT256).send(this.sendParam(this.Deployer))
|
||||
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)
|
||||
|
||||
console.log(log.blueText("[Init DVM context]"));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ export class ProxyContext {
|
||||
//Functions
|
||||
DODOIncentive: Contract;
|
||||
mtFeeRateModel: Contract;
|
||||
MtFeeRateModelLogic: Contract;
|
||||
|
||||
Deployer: string;
|
||||
Maintainer: string;
|
||||
@@ -81,8 +80,6 @@ export class ProxyContext {
|
||||
var permissionManagerTemplate = await contracts.newContract(contracts.PERMISSION_MANAGER_NAME)
|
||||
var mtFeeRateModelTemplate = await contracts.newContract(contracts.FEE_RATE_MODEL_NAME)
|
||||
this.mtFeeRateModel = mtFeeRateModelTemplate;
|
||||
// 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,
|
||||
@@ -155,10 +152,6 @@ export class ProxyContext {
|
||||
[this.WETH.options.address]
|
||||
)
|
||||
|
||||
|
||||
this.MtFeeRateModelLogic = await contracts.newContract(contracts.FEE_RATE_MODEL_LOGIC_NAME)
|
||||
|
||||
|
||||
console.log(log.blueText("[Init DVM context]"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user