remove some todo

This commit is contained in:
owen05
2020-11-23 10:43:12 +08:00
parent 9a4480208c
commit 8458022a3c
12 changed files with 109 additions and 107 deletions

View File

@@ -17,7 +17,7 @@ contract DVMFunding is DVMVault {
uint256 baseInput = getBaseInput();
uint256 quoteInput = getQuoteInput();
require(baseInput > 0, "NO_BASE_INPUT");
uint256 baseReserve = _BASE_RESERVE_; // may save gas? 待确认
uint256 baseReserve = _BASE_RESERVE_;
uint256 quoteReserve = _QUOTE_RESERVE_;
uint256 mintAmount;
// case 1. initial supply
@@ -31,7 +31,6 @@ 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;
@@ -48,27 +47,30 @@ contract DVMFunding is DVMVault {
_sync();
}
//TODO:Router unwrap WETH
function sellShares(
address to,
uint256 shareAmount,
bytes calldata data
address to
// uint256 shareAmount,
// bytes calldata data
) external preventReentrant returns (uint256) {
require(_SHARES_[msg.sender] >= shareAmount, "SHARES_NOT_ENOUGH");
// require(_SHARES_[msg.sender] >= shareAmount, "SHARES_NOT_ENOUGH");
(uint256 baseBalance, uint256 quoteBalance) = getVaultBalance();
uint256 totalShares = totalSupply;
_burn(msg.sender, shareAmount);
uint256 shareAmount = _SHARES_[address(this)];
uint256 baseAmount = baseBalance.mul(shareAmount).div(totalShares);
uint256 quoteAmount = quoteBalance.mul(shareAmount).div(totalShares);
require(baseAmount > 0 && quoteAmount > 0, 'NO_DLP_INPUT');
_burn(address(this), shareAmount);
_transferBaseOut(to, baseAmount);
_transferQuoteOut(to, quoteAmount);
_sync();
if (data.length > 0)
IDODOCallee(msg.sender).DVMSellShareCall(
to,
shareAmount,
baseAmount,
quoteAmount,
data
);
// if (data.length > 0)
// IDODOCallee(msg.sender).DVMSellShareCall(
// to,
// shareAmount,
// baseAmount,
// quoteAmount,
// data
// );
}
}