simplify dvm

This commit is contained in:
owen05
2020-12-30 12:23:52 +08:00
parent f08455e033
commit 4e5accd62d
19 changed files with 165 additions and 407 deletions

View File

@@ -66,7 +66,7 @@ module.exports = async (deployer, network, accounts) => {
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
DODOCalleeHelperAddress = "0x507EBbb195CF54E0aF147A2b269C08a38EA36989";
DODORouteV2HelperAddress = "";
DODORouteV2HelperAddress = "0x3aAfE7c2643807718EFE35D6D529A74255cA4319";
//Template
CloneFactoryAddress = "0xf7959fe661124C49F96CF30Da33729201aEE1b27";
FeeRateModelTemplateAddress = "0xEF3137780B387313c5889B999D03BdCf9aeEa892";
@@ -78,15 +78,15 @@ module.exports = async (deployer, network, accounts) => {
DefaultMtFeeRateAddress = "0xEfdE4225AC747136289979e29f1236527b2E4DB1";
DefaultPermissionAddress = "0xACc7E23368261e1E02103c4e5ae672E7D01f5797";
DvmTemplateAddress = "";
DvmTemplateAddress = "0x9d37C6BB2e3D62263099faAF2940C0De67a4FD6F";
DvmAdminTemplateAddress = "0x45f455d7E233403F10b7AFCB0d0d0c0d775AFf63";
DppTemplateAddress = "";
DppTemplateAddress = "0x75CC454c9771A7f1AF4848C4c3775C98b601563E";
DppAdminTemplateAddress = "0xDfdd9e1693C3A6AF25307c9dA561021f9e685878";
CpTemplateAddress = "";
CpTemplateAddress = "0x60580b981f2670C872AF0119b21C6596Ad7C5D51";
//Factory
DvmFactoryAddress = "";
DppFactoryAddress = "";
CpFactoryAddress = "";
DvmFactoryAddress = "0xF2a62693FB14b326C3719e5aeEF28e8e66dC954e";
DppFactoryAddress = "0x58Bc8D248AcbE95CE29CF893C6666D58AF92d941";
CpFactoryAddress = "0xD2d3c70C75E4Bb10eE366C8f54A06cCdDF5F3906";
//Approve
DODOApproveAddress = "";
//Account
@@ -163,7 +163,7 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: HELPER V2");
await deployer.deploy(DODOV2RouteHelper, "0x6cbAE38DF513356878cF8e859A33E0eA92BfE023","0x92fE64e923d3B2A2479fACfFF7DAE8a3056Dc4E1");
await deployer.deploy(DODOV2RouteHelper, "0xF2a62693FB14b326C3719e5aeEF28e8e66dC954e","0x58Bc8D248AcbE95CE29CF893C6666D58AF92d941");
DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
}

View File

@@ -13,38 +13,54 @@ const DVMFactory = artifacts.require("DVMFactory");
const DPPFactory = artifacts.require("DPPFactory");
const POOL_PARAM = [
// {
// baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0
// quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC
// lpFeeRate: "3000000000000000", //0.003
// mtFeeRate: "1000000000000000", //0.001
// i: "10000000", //10
// k: "500000000000000000" //0.5
// },
// {
// baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0
// quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT
// lpFeeRate: "3000000000000000", //0.003
// mtFeeRate: "1000000000000000", //0.001
// i: "10000000", //10
// k: "0" //0
// },
// {
// baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1
// quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC
// lpFeeRate: "3000000000000000", //0.003
// mtFeeRate: "1000000000000000", //0.001
// i: "5000000", //5
// k: "1000000000000000000" //1
// },
// {
// baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1
// quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT
// lpFeeRate: "3000000000000000", //0.003
// mtFeeRate: "1000000000000000", //0.001
// i: "8000000", //8
// k: "900000000000000000" //0.9
// },
{
baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0
quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC
quoteAddr: "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b", //WETH
lpFeeRate: "3000000000000000", //0.003
mtFeeRate: "1000000000000000", //0.001
i: "10000000", //10
k: "500000000000000000" //0.5
},
{
baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0
quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT
lpFeeRate: "3000000000000000", //0.003
mtFeeRate: "1000000000000000", //0.001
i: "10000000", //10
k: "0" //0
i: "45000000000000000000", //45
k: "800000000000000000" //0.8
},
{
baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1
quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC
quoteAddr: "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b", //WETH
lpFeeRate: "3000000000000000", //0.003
mtFeeRate: "1000000000000000", //0.001
i: "5000000", //5
k: "1000000000000000000" //1
i: "30000000000000000000", //30
k: "300000000000000000" //0.3
},
{
baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1
quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT
lpFeeRate: "3000000000000000", //0.003
mtFeeRate: "1000000000000000", //0.001
i: "8000000", //8
k: "900000000000000000" //0.9
}
];
module.exports = async (deployer, network, accounts) => {
@@ -56,8 +72,8 @@ module.exports = async (deployer, network, accounts) => {
let DPPFactoryAddress = "0x58Bc8D248AcbE95CE29CF893C6666D58AF92d941";
let DVMFactoryAddress = "0xF2a62693FB14b326C3719e5aeEF28e8e66dC954e";
let DODOApproveAddress = "0x9F332B3a07536A2b0caaB3E3b9D2a5dFD6173c6c";
let DODOProxyV2Address = "0xd5C27770E8e2F43B959484971472a0019b17fA56";
let DODOApproveAddress = "0xeEA9F08eBfde6915AB1C0051F3eB2612DbA95d5D";
let DODOProxyV2Address = "0x97B779AD504bbd5b1BFB50e57584a876Dc65171a";
const provider = new Web3.providers.HttpProvider("https://kovan.infura.io/v3/22d4a3b2df0e47b78d458f43fe50a199");
@@ -71,6 +87,17 @@ module.exports = async (deployer, network, accounts) => {
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if(deploySwitch.MANUAL_ADD_POOL) {
logger.log("Manual add Pool: V2");
const DPPFactoryInstance = await DPPFactory.at(DPPFactoryAddress);
var tx = await DPPFactoryInstance.addPoolByAdmin(
"0x7e83d9d94837ee82f0cc18a691da6f42f03f1d86",
"0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b",
"0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e",
"0x5e6e4B49bd79B76850650DB670Ca470ccC19d854"
);
logger.log("Manual add Pool Tx:" + tx.tx);
}
if (deploySwitch.MOCK_V2_SWAP) {
logger.log("Mock SWAP Tx: V2");
@@ -132,7 +159,8 @@ module.exports = async (deployer, network, accounts) => {
const assetTo = accounts[0];
const baseInAmount = web3.utils.toWei("1000", 'ether');
const quoteInAmount = web3.utils.toWei("100", 'mwei');
// const quoteInAmount = web3.utils.toWei("100", 'mwei');
const quoteInAmount = web3.utils.toWei("0", 'ether');
const deadline = Math.floor(new Date().getTime() / 1000 + 60 * 10);
//DVM Pool
for (var i = 0; i < POOL_PARAM.length; i++) {