add cp event && smartroute helper fix
This commit is contained in:
@@ -25,6 +25,7 @@ contract CPFunding is CPStorage {
|
||||
|
||||
event Bid(address to, uint256 amount, uint256 fee);
|
||||
event Cancel(address to,uint256 amount);
|
||||
event Settle();
|
||||
|
||||
// ============ BID & CALM PHASE ============
|
||||
|
||||
@@ -102,6 +103,8 @@ contract CPFunding is CPStorage {
|
||||
_TOTAL_LP_AMOUNT_ = IDVM(_POOL_).buyShares(address(this));
|
||||
|
||||
msg.sender.transfer(_SETTEL_FUND_);
|
||||
|
||||
emit Settle();
|
||||
}
|
||||
|
||||
// in case something wrong with base token contract
|
||||
|
||||
@@ -27,6 +27,12 @@ contract CPVesting is CPFunding {
|
||||
using SafeMath for uint256;
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
// ============ Events ============
|
||||
|
||||
event Claim(address user, uint256 baseAmount, uint256 quoteAmount);
|
||||
event ClaimLP(uint256 amount);
|
||||
|
||||
|
||||
// ================ Modifiers ================
|
||||
|
||||
modifier afterSettlement() {
|
||||
@@ -55,12 +61,15 @@ contract CPVesting is CPFunding {
|
||||
IDODOCallee(to).CPClaimBidCall(msg.sender,baseAmount,quoteAmount,data);
|
||||
}
|
||||
|
||||
emit Claim(msg.sender, baseAmount, quoteAmount);
|
||||
}
|
||||
|
||||
// ============ Owner Functions ============
|
||||
|
||||
function claimLPToken() external onlyOwner afterFreeze {
|
||||
IERC20(_POOL_).safeTransfer(_OWNER_, getClaimableLPToken());
|
||||
uint256 lpAmount = getClaimableLPToken();
|
||||
IERC20(_POOL_).safeTransfer(_OWNER_, lpAmount);
|
||||
emit ClaimLP(lpAmount);
|
||||
}
|
||||
|
||||
function getClaimableLPToken() public view afterFreeze returns (uint256) {
|
||||
|
||||
@@ -143,7 +143,8 @@ contract DODOIncentive is InitializableOwnable {
|
||||
uint256 reward,
|
||||
uint256 baseRate,
|
||||
uint256 totalRate,
|
||||
uint256 curTotalReward
|
||||
uint256 curTotalReward,
|
||||
uint256 perBlockReward
|
||||
)
|
||||
{
|
||||
baseRate = defaultRate;
|
||||
@@ -153,5 +154,6 @@ contract DODOIncentive is InitializableOwnable {
|
||||
uint256 _totalReward = _getTotalReward();
|
||||
reward = ((_totalReward - totalDistribution) * totalRate) / 1000;
|
||||
curTotalReward = _totalReward - totalDistribution;
|
||||
perBlockReward = dodoPerBlock;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,9 +355,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(_ETH_ADDRESS_,toToken,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, _ETH_ADDRESS_, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
_ETH_ADDRESS_,
|
||||
@@ -411,9 +409,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(fromToken,_ETH_ADDRESS_,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, fromToken, _ETH_ADDRESS_);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
@@ -467,9 +463,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(fromToken,toToken,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, fromToken, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
@@ -525,9 +519,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_externalGasReturn();
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(fromToken,toToken,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, fromToken, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
@@ -596,9 +588,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(_fromToken,_toToken,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, _fromToken, _toToken);
|
||||
|
||||
emit OrderHistory(_fromToken, _toToken, msg.sender, fromTokenAmount, returnAmount);
|
||||
}
|
||||
@@ -611,35 +601,28 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 minReturnAmount,
|
||||
address[] memory mixAdapters,
|
||||
address[] memory mixPairs,
|
||||
address[] memory assetTo,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
uint256 deadLine
|
||||
) external override payable judgeExpired(deadLine) returns (uint256 returnAmount) {
|
||||
require(mixPairs.length > 0, "DODOV2Proxy01: PAIRS_EMPTY");
|
||||
require(mixPairs.length == mixAdapters.length, "DODOV2Proxy01: ADAPTER_PAIR_NOT_MATCH");
|
||||
require(mixPairs.length == mixAdapters.length, "DODOV2Proxy01: PAIR_ADAPTER_NOT_MATCH");
|
||||
require(mixPairs.length == assetTo.length - 1, "DODOV2Proxy01: PAIR_ASSETTO_NOT_MATCH");
|
||||
require(minReturnAmount > 0, "DODOV2Proxy01: RETURN_AMOUNT_ZERO");
|
||||
|
||||
uint256 toTokenOriginBalance = IERC20(toToken).universalBalanceOf(msg.sender);
|
||||
|
||||
{
|
||||
address _fromToken = fromToken;
|
||||
_deposit(msg.sender, mixPairs[0], _fromToken, fromTokenAmount, _fromToken == _ETH_ADDRESS_);
|
||||
_deposit(msg.sender, assetTo[0], _fromToken, fromTokenAmount, _fromToken == _ETH_ADDRESS_);
|
||||
}
|
||||
|
||||
address assetTo = toToken == _ETH_ADDRESS_ ? address(this): msg.sender;
|
||||
for (uint256 i = 0; i < mixPairs.length; i++) {
|
||||
if (i == mixPairs.length - 1) {
|
||||
if (directions & 1 == 0) {
|
||||
IDODOAdapter(mixAdapters[i]).sellBase(assetTo,mixPairs[i]);
|
||||
} else {
|
||||
IDODOAdapter(mixAdapters[i]).sellQuote(assetTo,mixPairs[i]);
|
||||
}
|
||||
if (directions & 1 == 0) {
|
||||
IDODOAdapter(mixAdapters[i]).sellBase(assetTo[i + 1],mixPairs[i]);
|
||||
} else {
|
||||
if (directions& 1 == 0) {
|
||||
IDODOAdapter(mixAdapters[i]).sellBase(mixPairs[i + 1],mixPairs[i]);
|
||||
} else {
|
||||
IDODOAdapter(mixAdapters[i]).sellQuote(mixPairs[i + 1],mixPairs[i]);
|
||||
}
|
||||
IDODOAdapter(mixAdapters[i]).sellQuote(assetTo[i + 1],mixPairs[i]);
|
||||
}
|
||||
directions = directions >> 1;
|
||||
}
|
||||
@@ -656,9 +639,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
|
||||
_externalGasReturn();
|
||||
|
||||
if(isIncentive) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(fromToken,toToken,msg.sender);
|
||||
}
|
||||
_execIncentive(isIncentive, fromToken, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
@@ -794,4 +775,11 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
IChi(_CHI_TOKEN_).freeUpTo(_gasExternalReturn);
|
||||
}
|
||||
}
|
||||
|
||||
function _execIncentive(bool isIncentive, address fromToken,address toToken) internal {
|
||||
if(isIncentive && gasleft() > 30000) {
|
||||
IDODOIncentive(_DODO_INCENTIVE_).triggerIncentive(fromToken, toToken, msg.sender);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ contract DODOV1Adapter is IDODOAdapter {
|
||||
uint256 curAmountIn = IERC20(curBase).balanceOf(address(this));
|
||||
IERC20(curBase).universalApproveMax(pool, curAmountIn);
|
||||
IDODOV1(pool).sellBaseToken(curAmountIn, 0, "");
|
||||
if(to == msg.sender) {
|
||||
if(to != address(this)) {
|
||||
address curQuote = IDODOV1(pool)._QUOTE_TOKEN_();
|
||||
IERC20(curQuote).transfer(to,IERC20(curQuote).balanceOf(address(this)));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ contract DODOV1Adapter is IDODOAdapter {
|
||||
curAmountIn
|
||||
);
|
||||
IDODOV1(pool).buyBaseToken(canBuyBaseAmount, curAmountIn, "");
|
||||
if(to == msg.sender) {
|
||||
if(to != address(this)) {
|
||||
address curBase = IDODOV1(pool)._BASE_TOKEN_();
|
||||
IERC20(curBase).transfer(to,IERC20(curBase).balanceOf(address(this)));
|
||||
}
|
||||
|
||||
46
contracts/SmartRoute/helper/DODOV1PmmHelper.sol
Normal file
46
contracts/SmartRoute/helper/DODOV1PmmHelper.sol
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {IDODOV1} from "../intf/IDODOV1.sol";
|
||||
|
||||
contract DODOV1PmmHelper {
|
||||
|
||||
struct PairDetail {
|
||||
uint256 i;
|
||||
uint256 K;
|
||||
uint256 B;
|
||||
uint256 Q;
|
||||
uint256 B0;
|
||||
uint256 Q0;
|
||||
uint256 R;
|
||||
uint256 lpFeeRate;
|
||||
uint256 mtFeeRate;
|
||||
address baseToken;
|
||||
address quoteToken;
|
||||
address curPair;
|
||||
uint256 pairVersion;
|
||||
}
|
||||
|
||||
function getPairDetail(address pool) external view returns (PairDetail[] memory res) {
|
||||
res = new PairDetail[](1);
|
||||
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),pool,1);
|
||||
curRes.i = IDODOV1(pool).getOraclePrice();
|
||||
curRes.K = IDODOV1(pool)._K_();
|
||||
curRes.B = IDODOV1(pool)._BASE_BALANCE_();
|
||||
curRes.Q = IDODOV1(pool)._QUOTE_BALANCE_();
|
||||
(curRes.B0,curRes.Q0) = IDODOV1(pool).getExpectedTarget();
|
||||
curRes.R = IDODOV1(pool)._R_STATUS_();
|
||||
curRes.lpFeeRate = IDODOV1(pool)._LP_FEE_RATE_();
|
||||
curRes.mtFeeRate = IDODOV1(pool)._MT_FEE_RATE_();
|
||||
curRes.baseToken = IDODOV1(pool)._BASE_TOKEN_();
|
||||
curRes.quoteToken = IDODOV1(pool)._QUOTE_TOKEN_();
|
||||
res[0] = curRes;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ contract DODOV2RouteHelper {
|
||||
address baseToken;
|
||||
address quoteToken;
|
||||
address curPair;
|
||||
uint256 pairVersion;
|
||||
}
|
||||
|
||||
constructor(address dvmFactory,address dppFactory) public {
|
||||
@@ -40,7 +41,7 @@ contract DODOV2RouteHelper {
|
||||
uint256 len = baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length + baseToken1DPP.length;
|
||||
res = new PairDetail[](len);
|
||||
for(uint8 i = 0; i < len; i++) {
|
||||
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),address(0));
|
||||
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),address(0),2);
|
||||
address cur;
|
||||
if(i < baseToken0DVM.length) {
|
||||
cur = baseToken0DVM[i];
|
||||
|
||||
@@ -58,9 +58,9 @@ interface IDODOV1 {
|
||||
|
||||
function _QUOTE_CAPITAL_TOKEN_() external returns (address);
|
||||
|
||||
function _BASE_TOKEN_() external returns (address);
|
||||
function _BASE_TOKEN_() external view returns (address);
|
||||
|
||||
function _QUOTE_TOKEN_() external returns (address);
|
||||
function _QUOTE_TOKEN_() external view returns (address);
|
||||
|
||||
function _R_STATUS_() external view returns (uint8);
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ interface IDODOV2Proxy01 {
|
||||
uint256 minReturnAmount,
|
||||
address[] memory mixAdapters,
|
||||
address[] memory mixPairs,
|
||||
address[] memory assetTo,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
uint256 deadLine
|
||||
|
||||
@@ -277,3 +277,60 @@ DODOProxyV2 Address: 0xA730229607b710cd06AEAad1eDc644Dbb70A5E85
|
||||
Init DODOProxyV2 Tx: 0x70d3a11f506ca6bb54343ad9b92d40e799c146c4acb6c6b8104bac30e5909722
|
||||
DODOApprove Init tx: 0x60bdfcf5a37bcf3568d9e98e3d32acc9289515184305282dd035475c195e0d6e
|
||||
DODOIncentive ChangeProxy tx: 0xf34b766489b5833970e01a412c725ef0ae18043e5c421bdafacca2dfe7cb904a
|
||||
====================================================
|
||||
network type: bsclive
|
||||
Deploy time: 2021/1/15 下午3:53:19
|
||||
Deploy type: V2
|
||||
CloneFactoryAddress: 0x03E2427859119E497EB856a166F616a2Ce5f8c88
|
||||
DefaultMtFeeRateAddress: 0x1Cc229Ac0ef9ba932e4dEbB898C77901C9AFB694
|
||||
Init DefaultMtFeeRate Tx: 0x62ab882cec61d29f283e5b7cd8471012f2a700df052ce273149ee6f964b56727
|
||||
DefaultPermissionAddress: 0x50C86A07457E99389d7b49761a4237B70f0824E9
|
||||
Init DefaultPermissionAddress Tx: 0x238251dbc48095f41c4bd47fd579d2cbde3f81774cd219dd15dfea9fd8313be1
|
||||
DODOApprove Address: 0x56901dB769bD923C18d5139eA7A818C444d114bC
|
||||
DODOProxyV2 Address: 0x066f562B745Af2Ee6e33957708E3073b1AD28AcA
|
||||
Init DODOProxyV2 Tx: 0xc9285ff79e4bee10c4781f7781c19268b41d83c6ca8341230ae5343d600e317d
|
||||
DODOApprove Init tx: 0x74bf3ecfd8c81ea5e28ed50d4e57d341279824f4faa6bf3e0bb6dd1f649d317a
|
||||
DODOV2Adapter Address: 0xAB623fBcaeb522046185051911209F5b2C2a2e1f
|
||||
UniAdapter Address: 0x5e530cD60931d9DE694a86827e76BB24493A1520
|
||||
DODOV1Adapter Address: 0xe281A2686B90ACB58DB86E54da78e4050A22c775
|
||||
DODOV1Adapter Address: 0xcB7B4A2CfbFF595c17074534874116b0cF1849C6
|
||||
====================================================
|
||||
network type: bsclive
|
||||
Deploy time: 2021/1/15 下午8:27:03
|
||||
Deploy type: V2
|
||||
DODOApprove Address: 0xd048896f96F71D819a8A2b752E50732798bfE854
|
||||
DODOProxyV2 Address: 0x4eC851895d85bfa6835241b3157ae10FfFD3BebC
|
||||
Init DODOProxyV2 Tx: 0xae543d91dfe704a75499539205c670b5122dd8178df543ab15932a1aef1ef8dc
|
||||
DODOApprove Init tx: 0x4c991da6b3d31e8fdfbbfe1eaa4461d62aa2dbfda8063130ee738b3ef747f61c
|
||||
====================================================
|
||||
network type: bsclive
|
||||
Deploy time: 2021/1/15 下午8:59:54
|
||||
Deploy type: V2
|
||||
DODOApprove Address: 0xeb06b5a57F74B481A10f3D4d08aA1971606cD9Fc
|
||||
DODOProxyV2 Address: 0xDc74abBbb40D82712a14a5C8C883153ab8c3f64E
|
||||
Init DODOProxyV2 Tx: 0x82e88fe1b9994e385b13c3e605f7aa6d8a03caeb8d4a326f76638712881f0d67
|
||||
DODOApprove Init tx: 0x68c70fd3db8d22aa6706a43e28dde9fa76fc874749719647edbf3879640d42b9
|
||||
====================================================
|
||||
network type: kovan
|
||||
Deploy time: 2021/1/17 上午11:28:48
|
||||
Deploy type: V2
|
||||
CpTemplateAddress: 0x6E0c3D0F6f916B8067999c6196A1806d80840a12
|
||||
DODOApprove Address: 0xa9c0900d4b08CD33F94B8874f4442BdCBC69e3a9
|
||||
DODOIncentiveAddress: 0x3D5cB1F1364A7188C2ca0497D1Efb5Bb3B6f37D3
|
||||
DODOIncentive Init tx: 0xd9932fd17c4fe612bebd3371e1283509f112f8c306f1b9bbde933af6f6a2a2b5
|
||||
CpFactoryAddress: 0xD0380eE83a44725a7683525392daAFe2bCA5e0bF
|
||||
Init CpFactory Tx: 0x40323a31d83ef7438bc14b3d39d357a88a2cb22d43290c24c86dec976115020b
|
||||
DODOProxyV2 Address: 0x26d2b3d75256fa11b80a64dA8A6e20375aB796CE
|
||||
Init DODOProxyV2 Tx: 0x2f4b5a2d527fb5e065988173068ec4cbaa432d16f319307325145156c38d6530
|
||||
DODOApprove Init tx: 0xc898fa61d5abc92f093dfd368708306e9554c19c1be4fb374b295d8ea60ac881
|
||||
DODOIncentive ChangeProxy tx: 0xddb8760d719ef2a39d0127f64a5ec079c14419af9c7ee4e3622c8a38c22f8644
|
||||
====================================================
|
||||
network type: kovan
|
||||
Deploy time: 2021/1/17 下午12:28:12
|
||||
Deploy type: V2 - Adapter
|
||||
DODOV1Adapter Address: 0x348E38Aa50AF7c4277E51Ef9fA0d38c646c4E2Da
|
||||
DODOV2Adapter Address: 0x0C652e999457DB6FD1842857C3a83867457176cB
|
||||
UniAdapter Address: 0x92FC2498B36d1b0Ad3F5315026Dd2529bE05a4Aa
|
||||
DODOV1RouterHelper Address: 0xC972069473a686b1c11Bd9347D719c87e6745d39
|
||||
DODOV2RouteHelper Address: 0x83eE2294e51b3A882dAF160F500775942065B153
|
||||
DODOV1RouterHelper Address: 0xE52ef9814B27C2D0Aed230fed3e6429B8D5A27e7
|
||||
|
||||
@@ -26,6 +26,11 @@ const DODOIncentive = artifacts.require("DODOIncentive");
|
||||
const DODOSellHelper = artifacts.require("DODOSellHelper");
|
||||
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
|
||||
const DODOV2RouteHelper = artifacts.require("DODOV2RouteHelper");
|
||||
const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper");
|
||||
|
||||
const DODOV1Adapter = artifacts.require("DODOV1Adapter");
|
||||
const DODOV2Adapter = artifacts.require("DODOV2Adapter");
|
||||
const UniAdapter = artifacts.require("UniAdapter");
|
||||
|
||||
|
||||
module.exports = async (deployer, network, accounts) => {
|
||||
@@ -69,7 +74,7 @@ module.exports = async (deployer, network, accounts) => {
|
||||
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
|
||||
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
|
||||
DODOCalleeHelperAddress = "0x507EBbb195CF54E0aF147A2b269C08a38EA36989";
|
||||
DODORouteV2HelperAddress = "";
|
||||
DODORouteV2HelperAddress = "0x0546641b5288942675A36345E25210695d1d4d50";
|
||||
//Template
|
||||
CloneFactoryAddress = "0xf7959fe661124C49F96CF30Da33729201aEE1b27";
|
||||
// FeeRateModelTemplateAddress = "0xEF3137780B387313c5889B999D03BdCf9aeEa892";
|
||||
@@ -81,13 +86,13 @@ module.exports = async (deployer, network, accounts) => {
|
||||
DefaultMtFeeRateAddress = "0xEfdE4225AC747136289979e29f1236527b2E4DB1";
|
||||
DefaultPermissionAddress = "0xACc7E23368261e1E02103c4e5ae672E7D01f5797";
|
||||
|
||||
DvmTemplateAddress = "";
|
||||
DppTemplateAddress = "";
|
||||
DvmTemplateAddress = "0xD47B0782EDdAc44Bd2B6a51C949feaE9Af382A51";
|
||||
DppTemplateAddress = "0xA0C3C6Ad75fBfaCb490E315BA762A6D20084b5a8";
|
||||
DppAdminTemplateAddress = "0xe39E02c4f269c4E235Ca8979a125608644c8924a";
|
||||
CpTemplateAddress = "";
|
||||
//Factory
|
||||
DvmFactoryAddress = "";
|
||||
DppFactoryAddress = "";
|
||||
DvmFactoryAddress = "0x01B7fCc1890Ab90Da33dE2F0dC54aDF3C7501F04";
|
||||
DppFactoryAddress = "0x67c4765D04C3848FFa7967231fc7B7E58f67A887";
|
||||
CpFactoryAddress = "";
|
||||
//Approve
|
||||
DODOApproveAddress = "";
|
||||
@@ -134,40 +139,59 @@ module.exports = async (deployer, network, accounts) => {
|
||||
DODOSellHelperAddress = "0x0F859706AeE7FcF61D5A8939E8CB9dBB6c1EDA33";
|
||||
WETHAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
|
||||
chiAddress = "0x0000000000000000000000000000000000000000";
|
||||
DODOCalleeHelperAddress = "";
|
||||
DODORouteV2HelperAddress = "";
|
||||
|
||||
DODOCalleeHelperAddress = "0x0000000000000000000000000000000000000000";
|
||||
DODORouteV2HelperAddress = "0x0000000000000000000000000000000000000000";
|
||||
//Template
|
||||
CloneFactoryAddress = "";
|
||||
CloneFactoryAddress = "0x03E2427859119E497EB856a166F616a2Ce5f8c88";
|
||||
// FeeRateModelTemplateAddress = "";
|
||||
// ConstFeeRateModelTemplateAddress = "";
|
||||
// PermissionManagerTemplateAddress = "";
|
||||
// ExternalValueTemplateAddress = "";
|
||||
//Default Template
|
||||
// DefaultGasSourceAddress = "";
|
||||
DefaultMtFeeRateAddress = "";
|
||||
DefaultPermissionAddress = "";
|
||||
DefaultMtFeeRateAddress = "0x1Cc229Ac0ef9ba932e4dEbB898C77901C9AFB694";
|
||||
DefaultPermissionAddress = "0x50C86A07457E99389d7b49761a4237B70f0824E9";
|
||||
|
||||
DvmTemplateAddress = "";
|
||||
DppTemplateAddress = "";
|
||||
DppAdminTemplateAddress = "";
|
||||
CpTemplateAddress = "";
|
||||
DvmTemplateAddress = "0x0000000000000000000000000000000000000000";
|
||||
DppTemplateAddress = "0x0000000000000000000000000000000000000000";
|
||||
DppAdminTemplateAddress = "0x0000000000000000000000000000000000000000";
|
||||
CpTemplateAddress = "0x0000000000000000000000000000000000000000";
|
||||
//Factory
|
||||
DvmFactoryAddress = "";
|
||||
DppFactoryAddress = "";
|
||||
CpFactoryAddress = "";
|
||||
DvmFactoryAddress = "0x0000000000000000000000000000000000000000";
|
||||
DppFactoryAddress = "0x0000000000000000000000000000000000000000";
|
||||
CpFactoryAddress = "0x0000000000000000000000000000000000000000";
|
||||
//Proxy
|
||||
DODOApproveAddress = "";
|
||||
DODOIncentiveAddress = "";
|
||||
DODOTokenAddress = "";
|
||||
DODOIncentiveAddress = "0x0000000000000000000000000000000000000000";
|
||||
DODOTokenAddress = "0x0000000000000000000000000000000000000000";
|
||||
//Account
|
||||
multiSigAddress = "0x4073f2b9bB95774531b9e23d206a308c614A943a";
|
||||
defaultMaintainer = "0x4073f2b9bB95774531b9e23d206a308c614A943a";
|
||||
// multiSigAddress = "0x4073f2b9bB95774531b9e23d206a308c614A943a";
|
||||
// defaultMaintainer = "0x4073f2b9bB95774531b9e23d206a308c614A943a";
|
||||
//For Test
|
||||
multiSigAddress = accounts[0];
|
||||
defaultMaintainer = accounts[0];
|
||||
} else return;
|
||||
|
||||
if (deploySwitch.ROUTER_HELPER) {
|
||||
await deployer.deploy(DODOV2RouteHelper, "0x369279f8e1cc936f7f9513559897B183d4B2F0Bd", "0x6D4a70354cd03ae3A8461eDE9A4dAd445a169a6B");
|
||||
DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
|
||||
logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
|
||||
await deployer.deploy(DODOV1PmmHelper);
|
||||
logger.log("DODOV1RouterHelper Address: ", DODOV1PmmHelper.address);
|
||||
// await deployer.deploy(DODOV2RouteHelper, "0x01B7fCc1890Ab90Da33dE2F0dC54aDF3C7501F04", "0x67c4765D04C3848FFa7967231fc7B7E58f67A887");
|
||||
// DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
|
||||
// logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
|
||||
}
|
||||
|
||||
if (deploySwitch.ADAPTER) {
|
||||
logger.log("====================================================");
|
||||
logger.log("network type: " + network);
|
||||
logger.log("Deploy time: " + new Date().toLocaleString());
|
||||
logger.log("Deploy type: V2 - Adapter");
|
||||
await deployer.deploy(DODOV1Adapter, DODOSellHelperAddress)
|
||||
logger.log("DODOV1Adapter Address: ", DODOV1Adapter.address);
|
||||
await deployer.deploy(DODOV2Adapter)
|
||||
logger.log("DODOV2Adapter Address: ", DODOV2Adapter.address);
|
||||
await deployer.deploy(UniAdapter)
|
||||
logger.log("UniAdapter Address: ", UniAdapter.address);
|
||||
}
|
||||
|
||||
if (deploySwitch.DEPLOY_V2) {
|
||||
@@ -327,6 +351,9 @@ module.exports = async (deployer, network, accounts) => {
|
||||
);
|
||||
CpFactoryAddress = CpFactory.address;
|
||||
logger.log("CpFactoryAddress: ", CpFactoryAddress);
|
||||
const CpFactoryInstance = await CpFactory.at(CpFactoryAddress);
|
||||
var tx = await CpFactoryInstance.initOwner(multiSigAddress);
|
||||
logger.log("Init CpFactory Tx:", tx.tx);
|
||||
}
|
||||
|
||||
if (DODORouteV2HelperAddress == "") {
|
||||
@@ -367,7 +394,7 @@ module.exports = async (deployer, network, accounts) => {
|
||||
logger.log("DODOIncentive ChangeProxy tx: ", tx.tx);
|
||||
|
||||
//3. Open trade incentive
|
||||
var tx = await DODOIncentiveInstance.changePerReward(10);
|
||||
var tx = await DODOIncentiveInstance.changePerReward("10000000000000000000");
|
||||
logger.log("DODOIncentive OpenSwitch tx: ", tx.tx);
|
||||
|
||||
//4. Transfer DODO to Trade Incentive
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const Web3 = require('web3');
|
||||
const { deploySwitch } = require('../truffle-config.js')
|
||||
// const file = fs.createWriteStream("../deploy-detail-v2.0.txt", { 'flags': 'a' });
|
||||
// let logger = new console.Console(file, file);
|
||||
|
||||
|
||||
const FeeRateModelLogic = artifacts.require("FeeRateModelLogic");
|
||||
const FeeRateModelLogicUpdate = artifacts.require("FeeRateModelLogicUpdate");
|
||||
|
||||
|
||||
module.exports = async (deployer, network, accounts) => {
|
||||
// let FeeRateModelLogicAddress;
|
||||
// let FeeRateModelLogicUpdateAddress;
|
||||
// await deployer.deploy(FeeRateModelLogic);
|
||||
// FeeRateModelLogicAddress = FeeRateModelLogic.address;
|
||||
// logger.log("FeeRateModelLogicAddress: ", FeeRateModelLogicAddress);
|
||||
|
||||
// await deployer.deploy(FeeRateModelLogicUpdate);
|
||||
// FeeRateModelLogicUpdateAddress = FeeRateModelLogicUpdate.address;
|
||||
// logger.log("FeeRateModelLogicUpdateAddress: ", FeeRateModelLogicUpdateAddress);
|
||||
};
|
||||
@@ -40,11 +40,12 @@ module.exports = {
|
||||
deploySwitch: {
|
||||
DEPLOY_V1: false,
|
||||
DEPLOY_V2: false,
|
||||
ADAPTER: false,
|
||||
MOCK_TOKEN: false,
|
||||
MOCK_V2_POOL: true,
|
||||
MOCK_V2_POOL: false,
|
||||
MOCK_V2_SWAP: false,
|
||||
MANUAL_ADD_POOL: false,
|
||||
ROUTER_HELPER: false
|
||||
ROUTER_HELPER: true
|
||||
},
|
||||
|
||||
networks: {
|
||||
|
||||
Reference in New Issue
Block a user