add todo && smartSwap event update
This commit is contained in:
@@ -50,7 +50,9 @@ contract DPPVault is DPPStorage {
|
||||
_checkStatus();
|
||||
}
|
||||
|
||||
//TODO: Route queryfunc 以及 withdraw and reset
|
||||
// todo 这里需要考虑,怎么一个tx同时更新k i 和 fee并reset
|
||||
//TODO: 修改feerate等
|
||||
function reset() public onlyOwner {
|
||||
_BASE_TARGET_ = _BASE_TOKEN_.balanceOf(address(this));
|
||||
_QUOTE_TARGET_ = _QUOTE_TOKEN_.balanceOf(address(this));
|
||||
@@ -67,6 +69,7 @@ contract DPPVault is DPPStorage {
|
||||
|
||||
// ============ Assets Transfer ============
|
||||
|
||||
//TODO:确定Amount后,内部调用
|
||||
function withdraw(
|
||||
address to,
|
||||
uint256 baseAmount,
|
||||
|
||||
@@ -31,6 +31,7 @@ contract DVMFunding is DVMVault {
|
||||
}
|
||||
// case 3. normal case
|
||||
if (baseReserve > 0 && quoteReserve > 0) {
|
||||
//TODO: (Route合约配合实现)
|
||||
uint256 baseInputRatio = DecimalMath.divFloor(baseInput, baseReserve);
|
||||
uint256 quoteInputRatio = DecimalMath.divFloor(quoteInput, quoteReserve);
|
||||
uint256 mintRatio = baseInputRatio > quoteInputRatio ? quoteInputRatio : baseInputRatio;
|
||||
|
||||
@@ -61,6 +61,7 @@ contract DVMStorage is InitializableOwnable, ReentrancyGuard {
|
||||
|
||||
// ============ Setting Functions ============
|
||||
|
||||
//TODO: owner权限问题论证
|
||||
function setLpFeeRateModel(address newLpFeeRateModel) external onlyOwner {
|
||||
_LP_FEE_RATE_MODEL_ = IFeeRateModel(newLpFeeRateModel);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ contract DVMTrader is DVMVault {
|
||||
{
|
||||
uint256 baseInput = getBaseInput();
|
||||
uint256 mtFee;
|
||||
//TODO:tx.origin 的潜在风险,直接写to
|
||||
(receiveQuoteAmount, mtFee) = querySellBase(tx.origin, baseInput);
|
||||
_transferQuoteOut(to, receiveQuoteAmount);
|
||||
_transferQuoteOut(_MAINTAINER_, mtFee);
|
||||
|
||||
@@ -39,6 +39,7 @@ contract DVMFactory is Ownable {
|
||||
_DEFAULT_GAS_PRICE_SOURCE_ = defaultGasPriceSource;
|
||||
}
|
||||
|
||||
|
||||
function createStandardDODOVendingMachine(
|
||||
address baseToken,
|
||||
address quoteToken,
|
||||
@@ -62,6 +63,9 @@ contract DVMFactory is Ownable {
|
||||
k
|
||||
);
|
||||
|
||||
//TODO: Create2
|
||||
//TODO: DVM作为Mapping的字段,维护自身属性
|
||||
//TODO: 创建者索引,便于my pool查询
|
||||
_REGISTRY_[baseToken][quoteToken].push(newVendorMachine);
|
||||
return newVendorMachine;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ contract SmartSwap is Ownable {
|
||||
IERC20 indexed toToken,
|
||||
address indexed sender,
|
||||
uint256 fromAmount,
|
||||
uint256 returnAmount
|
||||
uint256 returnAmount,
|
||||
uint256 timeStamp
|
||||
);
|
||||
|
||||
event ExternalRecord(address indexed to, address indexed sender);
|
||||
@@ -104,7 +105,7 @@ contract SmartSwap is Ownable {
|
||||
|
||||
require(returnAmount >= minReturnAmount, "DODO SmartSwap: Return amount is not enough");
|
||||
toToken.universalTransfer(msg.sender, returnAmount);
|
||||
emit OrderHistory(fromToken, toToken, msg.sender, fromTokenAmount, returnAmount);
|
||||
emit OrderHistory(fromToken, toToken, msg.sender, fromTokenAmount, returnAmount, block.timestamp);
|
||||
}
|
||||
|
||||
function externalSwap(
|
||||
@@ -137,7 +138,7 @@ contract SmartSwap is Ownable {
|
||||
|
||||
require(returnAmount >= minReturnAmount, "DODO SmartSwap: Return amount is not enough");
|
||||
toToken.universalTransfer(msg.sender, returnAmount);
|
||||
emit OrderHistory(fromToken, toToken, msg.sender, fromTokenAmount, returnAmount);
|
||||
emit OrderHistory(fromToken, toToken, msg.sender, fromTokenAmount, returnAmount, block.timestamp);
|
||||
emit ExternalRecord(to, msg.sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
====================================================
|
||||
network type: kovan
|
||||
Deploy time: 2020/11/20 上午10:58:49
|
||||
Deploy type: Smart Route
|
||||
SmartApprove Address: 0x0E5cf0e4658E371f93a6bDB7E72d6789Aff08666
|
||||
DODOSellHelper Address: 0xbdEae617F2616b45DCB69B287D52940a76035Fe3
|
||||
SmartSwap Address: 0x767A6FB2f5e908c4E573CaA2bc7f53D468ffd78E
|
||||
SmartApprovce setSmartSwap tx: 0xc9efe8b60cba3a2d288d487a7e512a3cfcdd017a25a923477323067546fbbec2
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = async (deployer, network, accounts) => {
|
||||
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
|
||||
DODOZooAddress = "0x92230e929a2226b29ed3441ae5524886347c60c8";
|
||||
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
|
||||
SmartApproveAddress = "0x5627b7DEb3055e1e899003FDca0716b32C382084";
|
||||
SmartApproveAddress = "";
|
||||
} else if (network == "live") {
|
||||
DODOSellHelperAddress = "0x533da777aedce766ceae696bf90f8541a4ba80eb";
|
||||
DODOZooAddress = "0x3a97247df274a17c59a3bd12735ea3fcdfb49950";
|
||||
@@ -35,7 +35,7 @@ module.exports = async (deployer, network, accounts) => {
|
||||
|
||||
if (DEPLOY_ROUTE) {
|
||||
logger.log("Deploy type: Smart Route");
|
||||
if (SmartApprove == "") {
|
||||
if (SmartApproveAddress == "") {
|
||||
await deployer.deploy(SmartApprove);
|
||||
SmartApproveAddress = SmartApprove.address;
|
||||
}
|
||||
@@ -45,7 +45,6 @@ module.exports = async (deployer, network, accounts) => {
|
||||
}
|
||||
logger.log("SmartApprove Address: ", SmartApproveAddress);
|
||||
logger.log("DODOSellHelper Address: ", DODOSellHelperAddress);
|
||||
|
||||
await deployer.deploy(
|
||||
SmartSwap,
|
||||
SmartApproveAddress,
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// const HDWalletProvider = require('@truffle/hdwallet-provider');
|
||||
// const infuraKey = "fj4jll3k.....";
|
||||
var HDWalletProvider = require("truffle-hdwallet-provider");
|
||||
var privKey = process.env.privKey;
|
||||
var infuraId = process.env.infuraId;
|
||||
//
|
||||
// const fs = require('fs');
|
||||
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
||||
@@ -52,6 +53,7 @@ module.exports = {
|
||||
gasPrice: 1,
|
||||
},
|
||||
kovan: {
|
||||
networkCheckTimeout: 100000,
|
||||
provider: function() {
|
||||
return new HDWalletProvider(privKey, "https://kovan.infura.io/v3/" + infuraId);
|
||||
},
|
||||
@@ -65,8 +67,8 @@ module.exports = {
|
||||
provider: function() {
|
||||
return new HDWalletProvider(privKey, "https://mainnet.infura.io/v3/" + infuraId);
|
||||
},
|
||||
gas: 4000000,
|
||||
gasPrice: 22000000000,
|
||||
gas: 3000000,
|
||||
gasPrice: 60000000000,
|
||||
network_id: 1,
|
||||
skipDryRun: true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user