deploy polygon
This commit is contained in:
53
config/matic-config.js
Normal file
53
config/matic-config.js
Normal file
@@ -0,0 +1,53 @@
|
||||
module.exports = {
|
||||
MATIC_CONFIG: {
|
||||
//TOKEN
|
||||
WETH: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
|
||||
CHI: "0x0000000000000000000000000000000000000000",
|
||||
DODO: "0x6B208E08dcF6BD51F50C5Da09d15B2D8E5C46Cf2",
|
||||
|
||||
//Helper
|
||||
DODOSellHelper: "0xDfaf9584F5d229A9DBE5978523317820A8897C5A",
|
||||
DODOCalleeHelper: "0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445",
|
||||
DODOV1PmmHelper: "0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",
|
||||
DODOV2RouteHelper: "0x958f79e2998DFe417208b9A07D799265B0298e58",
|
||||
|
||||
//Template
|
||||
CloneFactory: "0x729f7f44bf64Ce814716b6261e267DbE6cdf021c",
|
||||
FeeRateModel: "0x18b0bD918b55f995Fd404B872404378A62cb403b",
|
||||
PermissionManager: "0x550B2e7bD9605b8dcdd20d01bA73f1feB6ce289b",
|
||||
DVM: "0x041ABa00c57Dd47abC37A2931dF569a2A2cc57Be",
|
||||
DPP: "0x80930Cb1849F7D42531506fF45E66724338A821b",
|
||||
DSP: "0xbe9a66e49503e84ae59a4d0545365AABedf33b40",
|
||||
|
||||
DPPAdmin: "0xB5Dc5E183c2aCf02aB879A8569aB4EDAf147d537",
|
||||
CP: "0xf50BDc9E90B7a1c138cb7935071b85c417C4cb8e",
|
||||
ERC20: "0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",
|
||||
MintableERC20: "0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c",
|
||||
|
||||
//Factory
|
||||
DVMFactory: "0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E",
|
||||
DPPFactory: "0xE55154D09265b18aC7CDAC6E646672A5460389a1",
|
||||
DSPFactory: "0xa356867fDCEa8e71AEaF87805808803806231FdC",
|
||||
UpCpFactory: "0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619",
|
||||
CrowdPoolingFactory: "0x85351262f7474Ebe23FfAcD633cf20A491F1325D",
|
||||
ERC20Factory: "0xaeB5CF31b97dce6134e416129845e01106fFB177",
|
||||
|
||||
//Approve
|
||||
DODOApprove: "0x9aE501385Bc7996A2A4a1FBb00c8d3820611BCB5",
|
||||
DODOApproveProxy: "0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51",
|
||||
|
||||
//Adapter
|
||||
DODOV1Adapter: "0xB5397B2210f49e96a5EB2c9747Aa2bD9397d90C0",
|
||||
DODOV2Adapter: "0x02fCB21dc1cf221939C1d4277fB54016b5d32bC7",
|
||||
UniAdapter: "0xbef0C8Cd420b76e9d31509abbfd7f8C9f664527c",
|
||||
|
||||
//Proxy
|
||||
DODOV2Proxy: "0x45894C062E6f4E58B257e0826675355305dfef0d",
|
||||
DSPProxy: "0xfDDCA6ffCE24dF5bE3e8AaD32081822f86178048",
|
||||
CpProxy: "0x5480B32c03647ff5E5A653F0465E798DBe558B57",
|
||||
|
||||
//Account
|
||||
multiSigAddress: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",
|
||||
defaultMaintainer: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ const { MBTEST_CONFIG } = require("./config/mbtest-config");
|
||||
const { MBTESTNET_CONFIG } = require("./config/mbtestnet-config");
|
||||
const { OKTEST_CONFIG } = require("./config/oktest-config");
|
||||
const { ARBTEST_CONFIG } = require("./config/arbtest-config");
|
||||
const { MATIC_CONFIG } = require("./config/matic-config");
|
||||
|
||||
exports.GetConfig = function (network, accounts) {
|
||||
var CONFIG = {}
|
||||
@@ -44,6 +45,11 @@ exports.GetConfig = function (network, accounts) {
|
||||
CONFIG.multiSigAddress = accounts[0]
|
||||
CONFIG.defaultMaintainer = accounts[0]
|
||||
break;
|
||||
case "matic":
|
||||
CONFIG = MATIC_CONFIG
|
||||
CONFIG.multiSigAddress = accounts[0]
|
||||
CONFIG.defaultMaintainer = accounts[0]
|
||||
break;
|
||||
}
|
||||
return CONFIG
|
||||
}
|
||||
@@ -91,6 +91,6 @@ contract DSP is DSPTrader, DSPFunding {
|
||||
// ============ Version Control ============
|
||||
|
||||
function version() external pure returns (string memory) {
|
||||
return "DSP 1.0.0";
|
||||
return "DSP 1.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,12 @@ import {IDODOSellHelper} from "./helper/DODOSellHelper.sol";
|
||||
import {IERC20} from "../intf/IERC20.sol";
|
||||
import {IWETH} from "../intf/IWETH.sol";
|
||||
import {IUni} from "./intf/IUni.sol";
|
||||
import {IChi} from "./intf/IChi.sol";
|
||||
import {SafeMath} from "../lib/SafeMath.sol";
|
||||
import {UniversalERC20} from "./lib/UniversalERC20.sol";
|
||||
import {SafeERC20} from "../lib/SafeERC20.sol";
|
||||
import {DecimalMath} from "../lib/DecimalMath.sol";
|
||||
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
|
||||
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
|
||||
import {IDODOIncentive} from "../DODOToken/DODOIncentive.sol";
|
||||
import {IDODOAdapter} from "./intf/IDODOAdapter.sol";
|
||||
|
||||
/**
|
||||
@@ -43,11 +41,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
address public immutable _DODO_SELL_HELPER_;
|
||||
address public immutable _DVM_FACTORY_;
|
||||
address public immutable _DPP_FACTORY_;
|
||||
address public immutable _CP_FACTORY_;
|
||||
address public immutable _DODO_INCENTIVE_;
|
||||
address public immutable _CHI_TOKEN_;
|
||||
uint256 public _GAS_DODO_MAX_RETURN_ = 0;
|
||||
uint256 public _GAS_EXTERNAL_RETURN_ = 0;
|
||||
mapping (address => bool) public isWhiteListed;
|
||||
|
||||
// ============ Events ============
|
||||
@@ -74,21 +67,15 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
constructor(
|
||||
address dvmFactory,
|
||||
address dppFactory,
|
||||
address cpFactory,
|
||||
address payable weth,
|
||||
address dodoApproveProxy,
|
||||
address dodoSellHelper,
|
||||
address chiToken,
|
||||
address dodoIncentive
|
||||
address dodoSellHelper
|
||||
) public {
|
||||
_DVM_FACTORY_ = dvmFactory;
|
||||
_DPP_FACTORY_ = dppFactory;
|
||||
_CP_FACTORY_ = cpFactory;
|
||||
_WETH_ = weth;
|
||||
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
|
||||
_DODO_SELL_HELPER_ = dodoSellHelper;
|
||||
_CHI_TOKEN_ = chiToken;
|
||||
_DODO_INCENTIVE_ = dodoIncentive;
|
||||
}
|
||||
|
||||
function addWhiteList (address contractAddr) public onlyOwner {
|
||||
@@ -99,11 +86,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
isWhiteListed[contractAddr] = false;
|
||||
}
|
||||
|
||||
function updateGasReturn(uint256 newDodoGasReturn, uint256 newExternalGasReturn) public onlyOwner {
|
||||
_GAS_DODO_MAX_RETURN_ = newDodoGasReturn;
|
||||
_GAS_EXTERNAL_RETURN_ = newExternalGasReturn;
|
||||
}
|
||||
|
||||
// ============ DVM Functions (create & add liquidity) ============
|
||||
|
||||
function createDODOVendingMachine(
|
||||
@@ -320,7 +302,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 minReturnAmount,
|
||||
address[] memory dodoPairs,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
)
|
||||
external
|
||||
@@ -331,7 +313,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
{
|
||||
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
|
||||
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
|
||||
uint256 originGas = gasleft();
|
||||
|
||||
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
|
||||
IWETH(_WETH_).deposit{value: msg.value}();
|
||||
@@ -357,10 +338,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
returnAmount = IERC20(toToken).balanceOf(msg.sender).sub(originToTokenBalance);
|
||||
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
_execIncentive(isIncentive, _ETH_ADDRESS_, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
_ETH_ADDRESS_,
|
||||
toToken,
|
||||
@@ -376,7 +353,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 minReturnAmount,
|
||||
address[] memory dodoPairs,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
)
|
||||
external
|
||||
@@ -386,7 +363,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
{
|
||||
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
|
||||
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
|
||||
uint256 originGas = gasleft();
|
||||
|
||||
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(fromToken, msg.sender, dodoPairs[0], fromTokenAmount);
|
||||
|
||||
@@ -411,10 +387,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
IWETH(_WETH_).withdraw(returnAmount);
|
||||
msg.sender.transfer(returnAmount);
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
_execIncentive(isIncentive, fromToken, _ETH_ADDRESS_);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
_ETH_ADDRESS_,
|
||||
@@ -431,7 +403,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 minReturnAmount,
|
||||
address[] memory dodoPairs,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
)
|
||||
external
|
||||
@@ -441,7 +413,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
{
|
||||
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
|
||||
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
|
||||
uint256 originGas = gasleft();
|
||||
|
||||
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
|
||||
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(fromToken, msg.sender, dodoPairs[0], fromTokenAmount);
|
||||
@@ -464,10 +435,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
}
|
||||
returnAmount = IERC20(toToken).balanceOf(msg.sender).sub(originToTokenBalance);
|
||||
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
_execIncentive(isIncentive, fromToken, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
@@ -486,7 +453,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 fromTokenAmount,
|
||||
uint256 minReturnAmount,
|
||||
bytes memory callDataConcat,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
)
|
||||
external
|
||||
@@ -496,8 +463,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
returns (uint256 returnAmount)
|
||||
{
|
||||
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
|
||||
require(fromToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_SELL_CHI");
|
||||
require(toToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_BUY_CHI");
|
||||
|
||||
uint256 toTokenOriginBalance = IERC20(toToken).universalBalanceOf(msg.sender);
|
||||
if (fromToken != _ETH_ADDRESS_) {
|
||||
@@ -523,10 +488,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
returnAmount = IERC20(toToken).universalBalanceOf(msg.sender).sub(toTokenOriginBalance);
|
||||
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
|
||||
|
||||
_externalGasReturn();
|
||||
|
||||
_execIncentive(isIncentive, fromToken, toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
fromToken,
|
||||
toToken,
|
||||
@@ -543,7 +504,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
uint256 minReturnAmount,
|
||||
address[] memory dodoPairs,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
)
|
||||
external
|
||||
@@ -554,10 +515,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
{
|
||||
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
|
||||
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
|
||||
require(fromToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_SELL_CHI");
|
||||
require(toToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_BUY_CHI");
|
||||
|
||||
uint256 originGas = gasleft();
|
||||
|
||||
address _fromToken = fromToken;
|
||||
address _toToken = toToken;
|
||||
@@ -568,13 +526,11 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
address curDodoPair = dodoPairs[i];
|
||||
if (directions & 1 == 0) {
|
||||
address curDodoBase = IDODOV1(curDodoPair)._BASE_TOKEN_();
|
||||
require(curDodoBase != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_CHI");
|
||||
uint256 curAmountIn = IERC20(curDodoBase).balanceOf(address(this));
|
||||
IERC20(curDodoBase).universalApproveMax(curDodoPair, curAmountIn);
|
||||
IDODOV1(curDodoPair).sellBaseToken(curAmountIn, 0, "");
|
||||
} else {
|
||||
address curDodoQuote = IDODOV1(curDodoPair)._QUOTE_TOKEN_();
|
||||
require(curDodoQuote != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_CHI");
|
||||
uint256 curAmountIn = IERC20(curDodoQuote).balanceOf(address(this));
|
||||
IERC20(curDodoQuote).universalApproveMax(curDodoPair, curAmountIn);
|
||||
uint256 canBuyBaseAmount = IDODOSellHelper(_DODO_SELL_HELPER_).querySellQuoteToken(
|
||||
@@ -597,10 +553,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
|
||||
IERC20(_toToken).universalTransfer(msg.sender, returnAmount);
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
_execIncentive(isIncentive, _fromToken, _toToken);
|
||||
|
||||
emit OrderHistory(_fromToken, _toToken, msg.sender, fromTokenAmount, returnAmount);
|
||||
}
|
||||
|
||||
@@ -614,7 +566,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
address[] memory mixPairs,
|
||||
address[] memory assetTo,
|
||||
uint256 directions,
|
||||
bool isIncentive,
|
||||
bool,
|
||||
uint256 deadLine
|
||||
) external override payable judgeExpired(deadLine) returns (uint256 returnAmount) {
|
||||
require(mixPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
|
||||
@@ -625,20 +577,16 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
address _fromToken = fromToken;
|
||||
address _toToken = toToken;
|
||||
uint256 _fromTokenAmount = fromTokenAmount;
|
||||
|
||||
require(_fromToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_SELL_CHI");
|
||||
require(_toToken != _CHI_TOKEN_, "DODOV2Proxy02: NOT_SUPPORT_BUY_CHI");
|
||||
|
||||
uint256 originGas = gasleft();
|
||||
uint256 toTokenOriginBalance = IERC20(_toToken).universalBalanceOf(msg.sender);
|
||||
|
||||
_deposit(msg.sender, assetTo[0], _fromToken, _fromTokenAmount, _fromToken == _ETH_ADDRESS_);
|
||||
|
||||
for (uint256 i = 0; i < mixPairs.length; i++) {
|
||||
if (directions & 1 == 0) {
|
||||
IDODOAdapter(mixAdapters[i]).sellBase(assetTo[i + 1],mixPairs[i]);
|
||||
IDODOAdapter(mixAdapters[i]).sellBase(assetTo[i + 1],mixPairs[i], "");
|
||||
} else {
|
||||
IDODOAdapter(mixAdapters[i]).sellQuote(assetTo[i + 1],mixPairs[i]);
|
||||
IDODOAdapter(mixAdapters[i]).sellQuote(assetTo[i + 1],mixPairs[i], "");
|
||||
}
|
||||
directions = directions >> 1;
|
||||
}
|
||||
@@ -652,10 +600,6 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
}
|
||||
|
||||
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
|
||||
|
||||
_dodoGasReturn(originGas);
|
||||
|
||||
_execIncentive(isIncentive, _fromToken, _toToken);
|
||||
|
||||
emit OrderHistory(
|
||||
_fromToken,
|
||||
@@ -666,43 +610,7 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
);
|
||||
}
|
||||
|
||||
//============ CrowdPooling Functions (create & bid) ============
|
||||
|
||||
function createCrowdPooling(
|
||||
address baseToken,
|
||||
address quoteToken,
|
||||
uint256 baseInAmount,
|
||||
uint256[] memory timeLine,
|
||||
uint256[] memory valueList,
|
||||
bool isOpenTWAP,
|
||||
uint256 deadLine
|
||||
) external override payable preventReentrant judgeExpired(deadLine) returns (address payable newCrowdPooling) {
|
||||
address _baseToken = baseToken;
|
||||
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
|
||||
|
||||
newCrowdPooling = IDODOV2(_CP_FACTORY_).createCrowdPooling();
|
||||
|
||||
_deposit(
|
||||
msg.sender,
|
||||
newCrowdPooling,
|
||||
_baseToken,
|
||||
baseInAmount,
|
||||
false
|
||||
);
|
||||
|
||||
newCrowdPooling.transfer(msg.value);
|
||||
|
||||
IDODOV2(_CP_FACTORY_).initCrowdPooling(
|
||||
newCrowdPooling,
|
||||
msg.sender,
|
||||
_baseToken,
|
||||
_quoteToken,
|
||||
timeLine,
|
||||
valueList,
|
||||
isOpenTWAP
|
||||
);
|
||||
}
|
||||
|
||||
//============ CrowdPooling Functions (bid) ============
|
||||
function bid(
|
||||
address cpAddress,
|
||||
uint256 quoteAmount,
|
||||
@@ -777,29 +685,4 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _dodoGasReturn(uint256 originGas) internal {
|
||||
uint256 _gasDodoMaxReturn = _GAS_DODO_MAX_RETURN_;
|
||||
if(_gasDodoMaxReturn > 0) {
|
||||
uint256 calcGasTokenBurn = originGas.sub(gasleft()) / 65000;
|
||||
uint256 gasTokenBurn = calcGasTokenBurn > _gasDodoMaxReturn ? _gasDodoMaxReturn : calcGasTokenBurn;
|
||||
if(gasTokenBurn >= 3 && gasleft() > 27710 + gasTokenBurn * 6080)
|
||||
IChi(_CHI_TOKEN_).freeUpTo(gasTokenBurn);
|
||||
}
|
||||
}
|
||||
|
||||
function _externalGasReturn() internal {
|
||||
uint256 _gasExternalReturn = _GAS_EXTERNAL_RETURN_;
|
||||
if(_gasExternalReturn > 0) {
|
||||
if(gasleft() > 27710 + _gasExternalReturn * 6080)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ contract DODOV1Adapter is IDODOAdapter {
|
||||
_DODO_SELL_HELPER_ = dodoSellHelper;
|
||||
}
|
||||
|
||||
function sellBase(address to, address pool) external override {
|
||||
function sellBase(address to, address pool, bytes memory) external override {
|
||||
address curBase = IDODOV1(pool)._BASE_TOKEN_();
|
||||
uint256 curAmountIn = IERC20(curBase).tokenBalanceOf(address(this));
|
||||
IERC20(curBase).universalApproveMax(pool, curAmountIn);
|
||||
@@ -36,7 +36,7 @@ contract DODOV1Adapter is IDODOAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
function sellQuote(address to, address pool) external override {
|
||||
function sellQuote(address to, address pool, bytes memory) external override {
|
||||
address curQuote = IDODOV1(pool)._QUOTE_TOKEN_();
|
||||
uint256 curAmountIn = IERC20(curQuote).tokenBalanceOf(address(this));
|
||||
IERC20(curQuote).universalApproveMax(pool, curAmountIn);
|
||||
|
||||
@@ -11,11 +11,11 @@ import {IDODOV2} from "../intf/IDODOV2.sol";
|
||||
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
|
||||
|
||||
contract DODOV2Adapter is IDODOAdapter {
|
||||
function sellBase(address to, address pool) external override {
|
||||
function sellBase(address to, address pool, bytes memory) external override {
|
||||
IDODOV2(pool).sellBase(to);
|
||||
}
|
||||
|
||||
function sellQuote(address to, address pool) external override {
|
||||
function sellQuote(address to, address pool, bytes memory) external override {
|
||||
IDODOV2(pool).sellQuote(to);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ contract UniAdapter is IDODOAdapter {
|
||||
using SafeMath for uint;
|
||||
|
||||
//fromToken == token0
|
||||
function sellBase(address to, address pool) external override {
|
||||
function sellBase(address to, address pool, bytes memory) external override {
|
||||
address baseToken = IUni(pool).token0();
|
||||
(uint reserveIn, uint reserveOut,) = IUni(pool).getReserves();
|
||||
require(reserveIn > 0 && reserveOut > 0, 'UniAdapter: INSUFFICIENT_LIQUIDITY');
|
||||
@@ -32,7 +32,7 @@ contract UniAdapter is IDODOAdapter {
|
||||
}
|
||||
|
||||
//fromToken == token1
|
||||
function sellQuote(address to, address pool) external override {
|
||||
function sellQuote(address to, address pool, bytes memory) external override {
|
||||
address quoteToken = IUni(pool).token1();
|
||||
(uint reserveOut, uint reserveIn,) = IUni(pool).getReserves();
|
||||
require(reserveIn > 0 && reserveOut > 0, 'UniAdapter: INSUFFICIENT_LIQUIDITY');
|
||||
|
||||
@@ -10,7 +10,7 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
interface IDODOAdapter {
|
||||
|
||||
function sellBase(address to, address pool) external;
|
||||
function sellBase(address to, address pool, bytes memory data) external;
|
||||
|
||||
function sellQuote(address to, address pool) external;
|
||||
function sellQuote(address to, address pool, bytes memory data) external;
|
||||
}
|
||||
|
||||
@@ -91,15 +91,6 @@ interface IDODOV2Proxy01 {
|
||||
uint256 deadLine
|
||||
) external payable;
|
||||
|
||||
function createCrowdPooling(
|
||||
address baseToken,
|
||||
address quoteToken,
|
||||
uint256 baseInAmount,
|
||||
uint256[] memory timeLine,
|
||||
uint256[] memory valueList,
|
||||
bool isOpenTWAP,
|
||||
uint256 deadLine
|
||||
) external payable returns (address payable newCrowdPooling);
|
||||
|
||||
function bid(
|
||||
address cpAddress,
|
||||
|
||||
@@ -137,9 +137,9 @@ contract DODORouteProxy {
|
||||
}
|
||||
|
||||
if(direction == 0) {
|
||||
IDODOAdapter(adapter).sellBase(assetFrom[i], pool);
|
||||
IDODOAdapter(adapter).sellBase(assetFrom[i], pool, "");
|
||||
} else {
|
||||
IDODOAdapter(adapter).sellQuote(assetFrom[i], pool);
|
||||
IDODOAdapter(adapter).sellQuote(assetFrom[i], pool, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -989,3 +989,99 @@ multiSigAddress: 0x7081685Ff3ff16FB6c0dF08AC93bdB7299EEEfc9
|
||||
DODOV2RouteHelper Address: 0x55793C2c8A796cCE00EF2D1a86CCA2E0399BF285
|
||||
DODOV2Proxy02 Address: 0x25B2f945Fec30F34b05d416C7c0b5c6c51A3ADdC
|
||||
Init DODOProxyV2 Tx: 0xeb923b51cc4ea3ec08107b3a7850471d523a358257e18a6abe3bbbc6e1933efa
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 上午11:10:26
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x7e83d9d94837eE82F0cc18a691da6f42F03F1d86
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 上午11:11:25
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 上午11:15:24
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 上午11:17:21
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
DODOSellHelper Address: 0xDfaf9584F5d229A9DBE5978523317820A8897C5A
|
||||
DODOCalleeHelperAddress: 0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445
|
||||
DODOV1RouterHelper Address: 0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2
|
||||
CloneFactoryAddress: 0x729f7f44bf64Ce814716b6261e267DbE6cdf021c
|
||||
DefaultMtFeeRateAddress: 0x18b0bD918b55f995Fd404B872404378A62cb403b
|
||||
Init DefaultMtFeeRateAddress Tx: 0x70107ad441ad6b7d32e5fec2f4eaa3ef93761d8aa7387efa726a65807fbf7ce0
|
||||
DefaultPermissionAddress: 0x550B2e7bD9605b8dcdd20d01bA73f1feB6ce289b
|
||||
Init DefaultPermissionAddress Tx: 0x095d5c4301448893c74d6649ad133b9c5f2fffcab4d51a7bffa8360e8e4cbff8
|
||||
DvmTemplateAddress: 0x041ABa00c57Dd47abC37A2931dF569a2A2cc57Be
|
||||
DspTemplateAddress: 0x72d220cE168C4f361dD4deE5D826a01AD8598f6C
|
||||
DppTemplateAddress: 0x80930Cb1849F7D42531506fF45E66724338A821b
|
||||
DppAdminTemplateAddress: 0xB5Dc5E183c2aCf02aB879A8569aB4EDAf147d537
|
||||
CpTemplateAddress: 0xf50BDc9E90B7a1c138cb7935071b85c417C4cb8e
|
||||
ERC20TemplateAddress: 0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25
|
||||
MintableERC20TemplateAddress: 0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c
|
||||
ERC20FactoryAddress: 0xaeB5CF31b97dce6134e416129845e01106fFB177
|
||||
DODOApprove Address: 0x9aE501385Bc7996A2A4a1FBb00c8d3820611BCB5
|
||||
DODOApproveProxy Address: 0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51
|
||||
DvmFactoryAddress: 0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E
|
||||
Init DvmFactory Tx: 0xf674e3f917c602d41e911f4f8c0173f826c9ff2acccf1501b2c790e9271c552c
|
||||
DppFactoryAddress: 0xE55154D09265b18aC7CDAC6E646672A5460389a1
|
||||
Init DppFactory Tx: 0x81d2fab9f9f3c894d43f355fd1ba70b3e07951fc8fe21c04aa9a430daa4b66ad
|
||||
CpFactoryAddress: 0x85351262f7474Ebe23FfAcD633cf20A491F1325D
|
||||
Init CpFactory Tx: 0x73f56fce4b149093e603b15cb6acfa7e489385067fb35912d2228344a219cda9
|
||||
DspFactoryAddress: 0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e
|
||||
Init DspFactory Tx: 0x4a1f64ac7d48184dae5fbec62dc5140f169839bccbb2e0855858a6a6f56fc2e3
|
||||
DODOV2RouteHelper Address: 0x9B64c81ba54eA51e1f6B7fefb3cfF8AA6F1e2A09
|
||||
DODODspProxy Address: 0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe
|
||||
====================================================
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午12:04:30
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午12:05:19
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午12:06:33
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
UpCrowdPoolingFactory address: 0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619
|
||||
Init UpCpFactory Tx: 0xfa4c72a31a0b31c453fb7195a9fbc38723ecfbd7f43104883a65eb0d2fd24102
|
||||
DODODspProxy Address: 0x40672211D4310ad71daDc8cDE7Aa3Fb90d420855
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午2:33:18
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午2:34:25
|
||||
Deploy type: V2
|
||||
multiSigAddress: 0x16CC37d06FE5061CD0023fb8d142ABaAbB396A2b
|
||||
DspFactoryAddress: 0xa356867fDCEa8e71AEaF87805808803806231FdC
|
||||
Init DspFactory Tx: 0x7bb88a8910a2bb324920d732456c047a007784f04e8c8bb06d6204b387718429
|
||||
DODOV2RouteHelper Address: 0xa2CB66EBB947D217f61510882096F6e95c1DE97D
|
||||
DODODspProxy Address: 0xfDDCA6ffCE24dF5bE3e8AaD32081822f86178048
|
||||
CpProxy address: 0x5480B32c03647ff5E5A653F0465E798DBe558B57
|
||||
DODOV2Proxy02 Address: 0x45894C062E6f4E58B257e0826675355305dfef0d
|
||||
Init DODOProxyV2 Tx: 0x4c1f2f9889776da4d118955accd3aaa05fc1eaa318707e8fe59706a067db4705
|
||||
DODOApproveProxy Init tx: 0x0bf2c291e8c3bcc1db6596eddb4e97cac3c7f0ec66166b5eb64e888b0b0f5599
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午2:56:31
|
||||
Deploy type: V2 - Adapter
|
||||
====================================================
|
||||
network type: matic
|
||||
Deploy time: 2021/5/11 下午2:57:22
|
||||
Deploy type: V2 - Adapter
|
||||
DODOV1Adapter Address: 0xB5397B2210f49e96a5EB2c9747Aa2bD9397d90C0
|
||||
DODOV2Adapter Address: 0x02fCB21dc1cf221939C1d4277fB54016b5d32bC7
|
||||
UniAdapter Address: 0xbef0C8Cd420b76e9d31509abbfd7f8C9f664527c
|
||||
|
||||
@@ -7,10 +7,14 @@ const { GetConfig } = require("../configAdapter.js")
|
||||
const CloneFactory = artifacts.require("CloneFactory");
|
||||
const FeeRateModelTemplate = artifacts.require("FeeRateModel");
|
||||
const PermissionManagerTemplate = artifacts.require("PermissionManager");
|
||||
const DODOSellHelper = artifacts.require("DODOSellHelper");
|
||||
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
|
||||
const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper");
|
||||
const DODOV2RouteHelper = artifacts.require("DODOV2RouteHelper");
|
||||
|
||||
const DvmTemplate = artifacts.require("DVM");
|
||||
const DppTemplate = artifacts.require("DPP");
|
||||
const DspTemplate = artifacts.require("DSP");
|
||||
const DppAdminTemplate = artifacts.require("DPPAdmin");
|
||||
const CpTemplate = artifacts.require("CP");
|
||||
|
||||
@@ -20,15 +24,16 @@ const ERC20Factory = artifacts.require("ERC20Factory");
|
||||
|
||||
const DvmFactory = artifacts.require("DVMFactory");
|
||||
const DppFactory = artifacts.require("DPPFactory");
|
||||
const DspFactory = artifacts.require("DSPFactory");
|
||||
const CpFactory = artifacts.require("CrowdPoolingFactory");
|
||||
const UpCpFactory = artifacts.require("UpCrowdPoolingFactory");
|
||||
|
||||
const DODOApprove = artifacts.require("DODOApprove");
|
||||
const DODOApproveProxy = artifacts.require("DODOApproveProxy");
|
||||
|
||||
const DODODspProxy = artifacts.require("DODODspProxy");
|
||||
const DODOCpProxy = artifacts.require("DODOCpProxy");
|
||||
const DODOProxyV2 = artifacts.require("DODOV2Proxy02");
|
||||
const DODOIncentive = artifacts.require("DODOIncentive");
|
||||
const DODOSellHelper = artifacts.require("DODOSellHelper");
|
||||
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
|
||||
const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper");
|
||||
|
||||
const DODOV1Adapter = artifacts.require("DODOV1Adapter");
|
||||
const DODOV2Adapter = artifacts.require("DODOV2Adapter");
|
||||
@@ -40,7 +45,6 @@ module.exports = async (deployer, network, accounts) => {
|
||||
if (CONFIG == null) return;
|
||||
//TOKEN
|
||||
let WETHAddress = CONFIG.WETH;
|
||||
let chiAddress = CONFIG.CHI;
|
||||
let DODOTokenAddress = CONFIG.DODO;
|
||||
|
||||
//Helper
|
||||
@@ -54,6 +58,7 @@ module.exports = async (deployer, network, accounts) => {
|
||||
let DefaultMtFeeRateAddress = CONFIG.FeeRateModel;
|
||||
let DefaultPermissionAddress = CONFIG.PermissionManager;
|
||||
let DvmTemplateAddress = CONFIG.DVM;
|
||||
let DspTemplateAddress = CONFIG.DSP;
|
||||
let DppTemplateAddress = CONFIG.DPP;
|
||||
let DppAdminTemplateAddress = CONFIG.DPPAdmin;
|
||||
let CpTemplateAddress = CONFIG.CP;
|
||||
@@ -62,17 +67,16 @@ module.exports = async (deployer, network, accounts) => {
|
||||
|
||||
//Facotry
|
||||
let DvmFactoryAddress = CONFIG.DVMFactory;
|
||||
let DspFactoryAddress = CONFIG.DSPFactory;
|
||||
let DppFactoryAddress = CONFIG.DPPFactory;
|
||||
let CpFactoryAddress = CONFIG.CrowdPoolingFactory;
|
||||
let UpCpFactoryAddress = CONFIG.UpCpFactory;
|
||||
let ERC20FactoryAddress = CONFIG.ERC20Factory;
|
||||
|
||||
//Approve
|
||||
let DODOApproveAddress = CONFIG.DODOApprove;
|
||||
let DODOApproveProxyAddress = CONFIG.DODOApproveProxy;
|
||||
|
||||
//Periphery
|
||||
let DODOIncentiveAddress = CONFIG.DODOIncentive;
|
||||
|
||||
//Account
|
||||
let multiSigAddress = CONFIG.multiSigAddress;
|
||||
let defaultMaintainer = CONFIG.defaultMaintainer;
|
||||
@@ -148,11 +152,19 @@ module.exports = async (deployer, network, accounts) => {
|
||||
DvmTemplateAddress = DvmTemplate.address;
|
||||
logger.log("DvmTemplateAddress: ", DvmTemplateAddress);
|
||||
}
|
||||
|
||||
if (DspTemplateAddress == "") {
|
||||
await deployer.deploy(DspTemplate);
|
||||
DspTemplateAddress = DspTemplate.address;
|
||||
logger.log("DspTemplateAddress: ", DspTemplateAddress);
|
||||
}
|
||||
|
||||
if (DppTemplateAddress == "") {
|
||||
await deployer.deploy(DppTemplate);
|
||||
DppTemplateAddress = DppTemplate.address;
|
||||
logger.log("DppTemplateAddress: ", DppTemplateAddress);
|
||||
}
|
||||
|
||||
if (DppAdminTemplateAddress == "") {
|
||||
await deployer.deploy(DppAdminTemplate);
|
||||
DppAdminTemplateAddress = DppAdminTemplate.address;
|
||||
@@ -199,16 +211,6 @@ module.exports = async (deployer, network, accounts) => {
|
||||
logger.log("DODOApproveProxy Address: ", DODOApproveProxyAddress);
|
||||
}
|
||||
|
||||
//Incentive
|
||||
if (DODOIncentiveAddress == "") {
|
||||
await deployer.deploy(DODOIncentive, DODOTokenAddress);
|
||||
DODOIncentiveAddress = DODOIncentive.address;
|
||||
logger.log("DODOIncentiveAddress: ", DODOIncentiveAddress);
|
||||
const DODOIncentiveInstance = await DODOIncentive.at(DODOIncentiveAddress);
|
||||
var tx = await DODOIncentiveInstance.initOwner(multiSigAddress);
|
||||
logger.log("DODOIncentive Init tx: ", tx.tx);
|
||||
}
|
||||
|
||||
//Factory
|
||||
if (DvmFactoryAddress == "") {
|
||||
await deployer.deploy(
|
||||
@@ -242,6 +244,23 @@ module.exports = async (deployer, network, accounts) => {
|
||||
logger.log("Init DppFactory Tx:", tx.tx);
|
||||
}
|
||||
|
||||
if (UpCpFactoryAddress == "") {
|
||||
await deployer.deploy(
|
||||
UpCpFactory,
|
||||
CloneFactoryAddress,
|
||||
CpTemplateAddress,
|
||||
DvmFactoryAddress,
|
||||
defaultMaintainer,
|
||||
DefaultMtFeeRateAddress,
|
||||
DefaultPermissionAddress
|
||||
);
|
||||
logger.log("UpCrowdPoolingFactory address: ", UpCpFactory.address);
|
||||
UpCpFactoryAddress = UpCpFactory.address;
|
||||
const UpCpFactoryInstance = await UpCpFactory.at(UpCpFactory.address);
|
||||
var tx = await UpCpFactoryInstance.initOwner(multiSigAddress);
|
||||
logger.log("Init UpCpFactory Tx:", tx.tx);
|
||||
}
|
||||
|
||||
if (CpFactoryAddress == "") {
|
||||
await deployer.deploy(
|
||||
CpFactory,
|
||||
@@ -259,23 +278,54 @@ module.exports = async (deployer, network, accounts) => {
|
||||
logger.log("Init CpFactory Tx:", tx.tx);
|
||||
}
|
||||
|
||||
// if (DODORouteV2HelperAddress == "") {
|
||||
// await deployer.deploy(DODOV2RouteHelper, DvmFactoryAddress, DppFactoryAddress);
|
||||
// DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
|
||||
// logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
|
||||
// }
|
||||
if (DspFactoryAddress == "") {
|
||||
await deployer.deploy(
|
||||
DspFactory,
|
||||
CloneFactoryAddress,
|
||||
DspTemplateAddress,
|
||||
defaultMaintainer,
|
||||
DefaultMtFeeRateAddress
|
||||
);
|
||||
DspFactoryAddress = DspFactory.address;
|
||||
logger.log("DspFactoryAddress: ", DspFactoryAddress);
|
||||
const DspFactoryInstance = await DspFactory.at(DspFactoryAddress);
|
||||
var tx = await DspFactoryInstance.initOwner(multiSigAddress);
|
||||
logger.log("Init DspFactory Tx:", tx.tx);
|
||||
}
|
||||
|
||||
if (DODORouteV2HelperAddress == "") {
|
||||
await deployer.deploy(DODOV2RouteHelper, DvmFactoryAddress, DppFactoryAddress, DspFactoryAddress);
|
||||
DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
|
||||
logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
|
||||
}
|
||||
|
||||
//Proxy
|
||||
await deployer.deploy(
|
||||
DODODspProxy,
|
||||
DspFactoryAddress,
|
||||
WETHAddress,
|
||||
DODOApproveProxyAddress
|
||||
);
|
||||
logger.log("DODODspProxy Address: ", DODODspProxy.address);
|
||||
|
||||
|
||||
await deployer.deploy(
|
||||
DODOCpProxy,
|
||||
WETHAddress,
|
||||
CpFactoryAddress,
|
||||
UpCpFactoryAddress,
|
||||
DODOApproveProxyAddress
|
||||
);
|
||||
logger.log("CpProxy address: ", DODOCpProxy.address);
|
||||
|
||||
|
||||
await deployer.deploy(
|
||||
DODOProxyV2,
|
||||
DvmFactoryAddress,
|
||||
DppFactoryAddress,
|
||||
CpFactoryAddress,
|
||||
WETHAddress,
|
||||
DODOApproveProxyAddress,
|
||||
DODOSellHelperAddress,
|
||||
chiAddress,
|
||||
DODOIncentiveAddress
|
||||
DODOSellHelperAddress
|
||||
);
|
||||
logger.log("DODOV2Proxy02 Address: ", DODOProxyV2.address);
|
||||
const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2.address);
|
||||
@@ -283,28 +333,16 @@ module.exports = async (deployer, network, accounts) => {
|
||||
logger.log("Init DODOProxyV2 Tx:", tx.tx);
|
||||
|
||||
|
||||
if (network == 'kovan' || network == 'mbtestnet' || network == 'oktest') {
|
||||
if (network == 'kovan' || network == 'mbtestnet' || network == 'oktest' || network == 'matic') {
|
||||
|
||||
const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress);
|
||||
var tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOProxyV2.address]);
|
||||
var tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOProxyV2.address, DODOCpProxy.address, DODODspProxy.address]);
|
||||
logger.log("DODOApproveProxy Init tx: ", tx.tx);
|
||||
|
||||
|
||||
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
|
||||
var tx = await DODOApproveInstance.init(multiSigAddress, DODOApproveProxy.address);
|
||||
logger.log("DODOApprove Init tx: ", tx.tx);
|
||||
|
||||
|
||||
//2. ChangeDODO Incentive proxy
|
||||
// const DODOIncentiveInstance = await DODOIncentive.at(DODOIncentiveAddress);
|
||||
// var tx = await DODOIncentiveInstance.changeDODOProxy(DODOProxyV2.address);
|
||||
// logger.log("DODOIncentive ChangeProxy tx: ", tx.tx);
|
||||
|
||||
//3. Open trade incentive
|
||||
// var tx = await DODOIncentiveInstance.changePerReward("10000000000000000000");
|
||||
// logger.log("DODOIncentive OpenSwitch tx: ", tx.tx);
|
||||
|
||||
//4. Transfer DODO to Trade Incentive
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,26 +39,26 @@ module.exports = {
|
||||
* $ truffle test --network <network-name>
|
||||
*/
|
||||
deploySwitch: {
|
||||
DEPLOY_V1: false,
|
||||
DEPLOY_V2: false,
|
||||
ADAPTER: false,
|
||||
MOCK_TOKEN: false,
|
||||
MOCK_V2_POOL: false,
|
||||
vDODOToken: false,
|
||||
DODORecharge: false,
|
||||
MINE: false,
|
||||
FEERATEIMPL: false,
|
||||
WETH: false,
|
||||
DODO: false,
|
||||
UpCP: false,
|
||||
DVM: false,
|
||||
CP: false,
|
||||
CPFactory: false,
|
||||
MultiCall: false,
|
||||
DSP: false,
|
||||
LockedVault: false,
|
||||
MULTIHOP: false,
|
||||
CpProxy: false
|
||||
DEPLOY_V1: false,
|
||||
DEPLOY_V2: false,
|
||||
ADAPTER: false,
|
||||
MOCK_TOKEN: false,
|
||||
MOCK_V2_POOL: false,
|
||||
vDODOToken: false,
|
||||
DODORecharge: false,
|
||||
MINE: false,
|
||||
FEERATEIMPL: false,
|
||||
WETH: false,
|
||||
DODO: false,
|
||||
UpCP: false,
|
||||
DVM: false,
|
||||
CP: false,
|
||||
CPFactory: false,
|
||||
MultiCall: false,
|
||||
DSP: false,
|
||||
LockedVault: false,
|
||||
MULTIHOP: false,
|
||||
CpProxy: false
|
||||
},
|
||||
|
||||
networks: {
|
||||
@@ -152,6 +152,17 @@ module.exports = {
|
||||
gasPrice: 0,
|
||||
},
|
||||
|
||||
matic: {
|
||||
provider: () => {
|
||||
return new HDWalletProvider(privKey, 'https://matic-mainnet-archive-rpc.bwarelabs.com')
|
||||
},
|
||||
network_id: 137,
|
||||
gasPrice: 1000000000,
|
||||
confirmations: 2,
|
||||
timeoutBlocks: 200,
|
||||
skipDryRun: true
|
||||
},
|
||||
|
||||
coverage: {
|
||||
host: "127.0.0.1",
|
||||
port: 6545,
|
||||
|
||||
Reference in New Issue
Block a user